How to Encrypt a Password in FoxProLast reviewed: April 29, 1996Article ID: Q99904 |
The information in this article applies to:
SUMMARYTo encrypt a password so that is not revealed, you can echo asterisks to the screen instead of the actual characters entered.
MORE INFORMATIONThe following sample code accepts a four-letter password and echoes four asterisks to the screen. This code must be executed from within a program, not from the Command window.
CLEAR CLEAR ALL SET TALK OFF && Prevents "double" echoing to the screen. STORE "" to x && Initialize memory variable x to character blank. @ 2,2 SAY "" && Position the password GET field on the screen. * The following loop sets up the number of characters in the * password. It can be modified to be any length. FOR y=1 TO 4 z=INKEY(0) && Initialize Z to integer value of zero. * Add, character by character, each letter of the password typed * in by the user. x=x+CHR(z) * Echo an * to the GET field on the screen for each letter that * the user types in. @ 2,2 SAY REPLICATE("*",y) ENDFOR ?X && To display the typed password.The code above can be modified to reflect a longer password or to echo a different character (other than the "*" character) on the GET field of the screen. If this encryption code is organized as a procedure, the memory variables x, y, and z must be declared as PUBLIC if they are passed into and out of the procedure.
|
Additional reference words: FoxDos FoxWin 1.02 2.00 2.50 2.50a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |