DM4BAEbyCLS : LOCATE 23, 1 PRINT "DM4BAE-Security" PRINT "---------------" PRINT "This consists of 1) a driver which can be used to debug" PRINT "the password verification functions" PRINT : PRINT DEFSTR A-Z ' Debugging PRINT "TEST: Refuse to enter a password" IF GetInitialPassword("White") <> 0 THEN STOP: ' Bug detected GOSUB Passed PRINT "TEST: Enter a password" RANDOMIZE TIMER wPass# = GetInitialPassword("White") IF wPass# = 0 THEN STOP: ' Bug detected GOSUB Passed PRINT "TEST: Enter an incorrect password" RANDOMIZE TIMER IF Authorized("White", wPass#) THEN STOP: ' Bug detected GOSUB Passed PRINT "TEST: Enter the correct password" RANDOMIZE TIMER IF NOT Authorized("White", wPass#) THEN STOP: ' Bug detected GOSUB Passed PRINT "Passed all tests!" PRINT "Now we are just in a loop to show the encrypted" PRINT "password value for possible study of technique" DO wPass# = GetInitialPassword("Black") PRINT wPass# LOOP UNTIL wPass# = 0 SYSTEM Passed: PRINT "------------ Passed Test -------------": PRINT : PRINT RETURN FUNCTION Authorized% (c$, pw#) PRINT "Simulating " + c$ + " being authorized" LINE INPUT "Password: "; pw$ IF ASC(LEFT$(pw$ + CHR$(0), 1)) = pw# THEN PRINT "Authorized": Authorized% = -1 ELSE PRINT "Not Authorized": Authorized% = 0 END IF END FUNCTION FUNCTION GetInitialPassword# (c$) PRINT "Simulating getting initial password for " + c$ PRINT "(Just press Enter if you are not that player)" INPUT "Password"; p$ IF p$ = "" THEN GetInitialPassword# = 0 ELSE GetInitialPassword# = ASC(LEFT$(p$, 1)) END IF END FUNCTION
from IP address 68.98.164.60 |