Password

Publication: LISTing Newsletter
Date: August 1985
Pages: 22

Blackburn,
Lancashire.
[contributor’s name blacked out in the copy]

THIS PASSWORD program for the Spectrum 48K will cause the listing to be jumbled. Only the correct password will restore the program and the program cannot be run without it.

The program should be typed in as listed and SAVEd on tape.

After writing your message or short program the Password program should be loaded with Merge ” “. Your program should not have any line numbered any higher than 9983. Then type

GOTO 9985

The program will ask for a password which, when Entered, will cause the screen to go blank and then show a Stop Statement.

You listing is now coded according to the password and can be saved as before with

SAVE “name” LINE 9985

When the program is reloaded the correct password must be entered to run the program.

It works by XORing the byte in the Basic program listing with the ASCII code of the password which is sliced in a loop.

Line 9991 looks for line 9984 to prevent poking the password program itself. Lines 9991 and 9992 prevent Poking into undesirable places. The short machine code routine does the XORing.

If you take two numbers and XOR them, then take this result and XOR it with one of the original numbers you will get the second original number.

9984 STOP : STOP
9985 RESTORE : CLEAR 32499: LET j=32500
9986 FOR f=0 TO 11: READ a: POKE j+f,a: NEXT f
9987 DATA 58,232,128,237,75,242,128,6,8,169,79,201
9988 INPUT "Password?";a$
9989 LET x=1
9990 FOR n=23759 TO 1e8
9991 IF PEEK n=13 THEN LET n=n+4: NEXT n
9992 IF PEEK n=14 THEN LET n=n+5: NEXT n
9993 IF PEEK n=226 AND PEEK (n+2)=226 THEN STOP
9994 POKE 33000,PEEK n: POKE 33010,CODE a$(x)+128
9995 LET l=USR 32500: IF l[illegible]32 THEN NEXT n
9996 POKE n,l
9997 LET x=x+1
9998 IF x>LEN a$ THEN LET x=1
9999 NEXT n

YOUR COMPUTER, JUNE 1985

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.