Classic Computer Magazine Archive COMPUTE! ISSUE 78 / NOVEMBER 1986 / PAGE 8

Disguised Input In BASIC

I have a Commodore computer and am writing a program with a code system. When I type in the code, anyone standing nearby can see it. Is there a way to replace each character in the code with an X or any other letter in order to disguise the code? I have noticed that 24-hour bank machines use this method to hide their customers' codes.

Michael Hamm

This simple routine waits for you to enter the word JUJUBE. Though it's written for Commodore computers, only slight modifications are needed to convert it for any computer with Microsoft BASIC. Use the DEL key to erase mistakes; input terminates when you press RETURN.

10 CODE$="JUJUBE"
20 B$="":PRINT "ENTER PASSWORD"
30 GET X$:IF X$="" THEN 30
40 IF X$=CHR$(20) AND LEN(B$)>0 THEN PRINT X$;:
      B$=LEFT$(B$,LEN(B?)-1):GOTO 40
50 IF X$=CHR$(20) THEN 30
60 IF X$<>CHR$(13) THEN PRINT" X";:B$=B$+X$:GOTO 30
70 IF B$<>CODE$ THEN PRINT:PRINT "INVALID CODE":GOTO 20
80 PRINT "WELCOME"