Password



Blackburn,

Lancashire.



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

        GO TO 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 bytes 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 pass-

word program itself. Lines 9991 and 9992 prevent POKEing

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.

  [Note that this program has one minor limitation: it does

not work well with embedded colour codes or other charac-

ters below the space. This is because line 9995 encodes

these low characters fine, but then fails to decode them.

It may be a minor limitation, and the alternative - running

the risk of accidentally encoding something into either an

end-of-line or a number indicator - much harder to avoid

and more serious; but it is something to be aware of. Try,

for example, to load "bug demo" and run it; then encode it

using "password" as a password, decode it, and run it

again. Now list it. Pretty, isn't it?]