DM1byDECLARE FUNCTION GetKey# () DECLARE SUB SimShow (m$) DECLARE FUNCTION ksgDecrypt$ (k#, Encrypted$) DECLARE FUNCTION ksgEncrypt$ (k#, Clear$) CLS : LOCATE 24, 1 PRINT "DM1 Kriegspiel Referee Debug Program" PRINT "------------------------------------" PRINT "This consists of a driver which can be used to debug" PRINT "the security routines and simulated security routines" PRINT "which can be used to debug the real calling program." MyKey1# = GetKey DIM MyKey AS DOUBLE: MyKey = GetKey IF MyKey1# <> MyKey THEN STOP: ' Bug - should always be the same. PRINT "Enter test data or null to quit" DO LINE INPUT "Test Data: ", Clear$ IF Clear$ = "" THEN CLS : SYSTEM Encrypted$ = ksgEncrypt(MyKey, Clear$) NewStuff$ = ksgDecrypt(MyKey, Encrypted$) PRINT : PRINT PRINT "Test Data: "; Clear$ PRINT "Hope Same: "; NewStuff$ LOOP FUNCTION GetKey# SimShow "GetKey is returning 41573" GetKey# = 41573 END FUNCTION FUNCTION ksgDecrypt$ (k#, Encrypted$) SimShow "ksgDecrypt decrypted text using " + STR$(k#) FOR i% = LEN(Encrypted$) TO 1 STEP -1 w$ = w$ + MID$(Encrypted$, i%, 1) NEXT i% ksgDecrypt$ = w$ END FUNCTION FUNCTION ksgEncrypt$ (k#, Clear$) SimShow "ksgEncrypt encrypted text using " + STR$(k#) FOR i% = LEN(Clear$) TO 1 STEP -1 w$ = w$ + MID$(Clear$, i%, 1) NEXT i% ksgEncrypt$ = w$ END FUNCTION SUB SimShow (m$) p$ = "": GOSUB SlowMe p$ = "": GOSUB SlowMe p$ = STRING$(LEN(m$), "="): GOSUB SlowMe p$ = m$: GOSUB SlowMe p$ = STRING$(LEN(m$), "="): GOSUB SlowMe EXIT SUB SlowMe: t = TIMER + .1: WHILE TIMER < t: WEND PRINT p$ RETURN END SUB from IP address 68.98.164.60 |