Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92 » !AWJan92/Goodies/FiveAlive/CODELIB

!AWJan92/Goodies/FiveAlive/CODELIB

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199201.adf » January92
Filename: !AWJan92/Goodies/FiveAlive/CODELIB
Read OK:
File size: 0D68 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >CODELIB
   20
   30DEFPROCdescribe_codelib
   40PRINT "FNencode_caesar(code$,message$)"
   50PRINT "FNdecode_caesar(code$,message$)"
   60PRINT "FNtext_key_encode(key$,message$)"
   70PRINT "FNtext_key_decode(key$,message$)"
   80PRINT "FNnumber_key_encode(key,message$)"
   90PRINT "PROCeor_code_memory(key,memstart,length)"
  100PRINT "PROCeor_code_file(key,infile$,outfile$)"
  110ENDPROC
  120
  130
  140DEFFNencode_caesar(code$,message$)
  150REM Encodes string using Caesarian letter cypher
  160LOCAL l,n,shift,base,end,code,asc,out$
  170n=LENmessage$
  180base = ASC("A"): end = base+25
  190code = ASC(code$)
  200IF code <base OR code >end THEN ERROR 99,"CAESAR CODE OUT OF RANGE A TO Z"
  210shift = code - base
  220out$=""
  230FOR l = 1 TO n
  240asc = ASC(MID$(message$,l,1))
  250IF asc >= base THEN asc += shift
  260IF asc > end THEN asc -= 26
  270out$ += CHR$asc
  280NEXT l
  290=out$
  300
  310DEFFNdecode_caesar(code$,message$)
  320REM Decodes string using Caesarian letter cypher
  330LOCAL l,n,shift,base,end,code,asc,out$
  340n=LENmessage$
  350base = ASC("A"): end = base+25
  360code = ASC(code$)
  370IF code <base OR code >end THEN ERROR 99,"CAESAR CODE OUT OF RANGE A TO Z"
  380shift = code - base
  390out$=""
  400FOR l = 1 TO n
  410asc = ASC(MID$(message$,l,1))
  420IF asc >= base THEN
  430asc -= shift
  440IF asc < base THEN asc += 26
  450ENDIF
  460out$ += CHR$asc
  470NEXT l
  480=out$
  490
  500DEFFNtext_key_encode(key$,message$)
  510REM Encodes string using succession of Caesarian codes derived
  520REM from a text key
  530LOCAL kn,kcount,code$,out$,mn,mcount,asc,base
  540base = ASC("A")
  550kn = LENkey$
  560kcount = 0
  570mn = LENmessage$
  580mcount = 0
  590WHILE mcount < mn
  600mcount +=1
  610REPEAT
  620kcount +=1
  630IF kcount > kn THEN kcount = 1
  640asc = ASC(MID$(key$,kcount,1))
  650UNTIL asc >= base
  660code$ = CHR$asc
  670out$ += FNencode_caesar(code$,MID$(message$,mcount,1))
  680ENDWHILE
  690=out$
  700
  710DEFFNtext_key_decode(key$,message$)
  720REM Decodes string using succession of Caesarian codes derived
  730REM from a text key
  740LOCAL kn,kcount,code$,out$,mn,mcount,asc,base
  750base = ASC("A")
  760kn = LENkey$
  770kcount = 0
  780mn = LENmessage$
  790mcount = 0
  800WHILE mcount < mn
  810mcount +=1
  820REPEAT
  830kcount +=1
  840IF kcount > kn THEN kcount = 1
  850asc = ASC(MID$(key$,kcount,1))
  860UNTIL asc >= base
  870code$ = CHR$asc
  880out$ += FNdecode_caesar(code$,MID$(message$,mcount,1))
  890ENDWHILE
  900=out$
  910
  920DEFFNnumber_key_encode(key,message$)
  930REM Encodes string using succession of Caesarian codes derived
  940REM from a numeric key seed to set random number generator
  950LOCAL mn, mcount, base, out$, dummy, code$
  960base = ASC"A"
  970mn = LENmessage$
  980out$=""
  990dummy = RND(-key)
 1000FOR mcount = 1 TO mn
 1010code$ = CHR$(base+RND(26)-1)
 1020out$ += FNencode_caesar(code$,MID$(message$,mcount,1))
 1030NEXT mcount
 1040=out$
 1050
 1060DEFFNnumber_key_decode(key,message$)
 1070REM Decodes string using succession of Caesarian codes derived
 1080REM from a numeric key seed to set random number generator
 1090LOCAL mn, mcount, base, out$, dummy, code$
 1100base = ASC"A"
 1110mn = LENmessage$
 1120out$=""
 1130dummy = RND(-key)
 1140FOR mcount = 1 TO mn
 1150code$ = CHR$(base+RND(26)-1)
 1160out$ += FNdecode_caesar(code$,MID$(message$,mcount,1))
 1170NEXT mcount
 1180=out$
 1190
 1200DEFPROCeor_code_memory(key,memstart,length)
 1210LOCAL i,word
 1220FOR i = 0 TO length STEP 4
 1230word = memstart!i
 1240memstart!i = word EOR key
 1250NEXT i
 1260ENDPROC
 1270
 1280DEFPROCeor_code_file(key,infile$,outfile$)
 1290REM Encodes/decodes a file of any type using and EOR key
 1300REM and saves scrambled file to disc
 1310LOCAL length, infile, memstart
 1320infile = OPENIN(infile$): length = EXT#infile: CLOSE#infile
 1330DIM memstart length
 1340OSCLI "LOAD "+infile$+ " "+STR$~memstart
 1350PROCeor_code_memory(key,memstart,length)
 1360OSCLI "SAVE "+outfile$+" "+STR$~memstart+" +"+STR$~length
 1370ENDPROC
 1380

� >CODELIB

��describe_codelib
('� "FNencode_caesar(code$,message$)"
2'� "FNdecode_caesar(code$,message$)"
<(� "FNtext_key_encode(key$,message$)"
F(� "FNtext_key_decode(key$,message$)"
P)� "FNnumber_key_encode(key,message$)"
Z0� "PROCeor_code_memory(key,memstart,length)"
d/� "PROCeor_code_file(key,infile$,outfile$)"
n�
x
�
�#ݤencode_caesar(code$,message$)
�2� Encodes string using Caesarian letter cypher
�&� l,n,shift,base,end,code,asc,out$
�n=�message$
� base = �("A"): end = base+25
�code = �(code$)
�E� code <base � code >end � � 99,"CAESAR CODE OUT OF RANGE A TO Z"
�shift = code - base
�out$=""
�� l = 1 � n
�asc = �(�message$,l,1))
� � asc >= base � asc += shift
� asc > end � asc -= 26
out$ += �asc
� l
"	=out$
,
6#ݤdecode_caesar(code$,message$)
@2� Decodes string using Caesarian letter cypher
J&� l,n,shift,base,end,code,asc,out$
Tn=�message$
^ base = �("A"): end = base+25
hcode = �(code$)
rE� code <base � code >end � � 99,"CAESAR CODE OUT OF RANGE A TO Z"
|shift = code - base
�out$=""
�� l = 1 � n
�asc = �(�message$,l,1))
�� asc >= base �
�asc -= shift
�� asc < base � asc += 26
��
�out$ += �asc
�� l
�	=out$
�
�$ݤtext_key_encode(key$,message$)
�@� Encodes string using succession of Caesarian codes derived
� from a text key
-� kn,kcount,code$,out$,mn,mcount,asc,base
base = �("A")
&kn = �key$
0kcount = 0
:mn = �message$
Dmcount = 0
Nȕ mcount < mn
Xmcount +=1
b�
lkcount +=1
v� kcount > kn � kcount = 1
�asc = �(�key$,kcount,1))
�� asc >= base
�code$ = �asc
�5out$ += �encode_caesar(code$,�message$,mcount,1))
��
�	=out$
�
�$ݤtext_key_decode(key$,message$)
�@� Decodes string using succession of Caesarian codes derived
�� from a text key
�-� kn,kcount,code$,out$,mn,mcount,asc,base
�base = �("A")
�kn = �key$
kcount = 0
mn = �message$
mcount = 0
 ȕ mcount < mn
*mcount +=1
4�
>kcount +=1
H� kcount > kn � kcount = 1
Rasc = �(�key$,kcount,1))
\� asc >= base
fcode$ = �asc
p5out$ += �decode_caesar(code$,�message$,mcount,1))
z�
�	=out$
�
�%ݤnumber_key_encode(key,message$)
�@� Encodes string using succession of Caesarian codes derived
�<� from a numeric key seed to set random number generator
�*� mn, mcount, base, out$, dummy, code$
�base = �"A"
�mn = �message$
�out$=""
�dummy = �(-key)
�� mcount = 1 � mn
�code$ = �(base+�(26)-1)
�5out$ += �encode_caesar(code$,�message$,mcount,1))
� mcount
	=out$

$%ݤnumber_key_decode(key,message$)
.@� Decodes string using succession of Caesarian codes derived
8<� from a numeric key seed to set random number generator
B*� mn, mcount, base, out$, dummy, code$
Lbase = �"A"
Vmn = �message$
`out$=""
jdummy = �(-key)
t� mcount = 1 � mn
~code$ = �(base+�(26)-1)
�5out$ += �decode_caesar(code$,�message$,mcount,1))
�� mcount
�	=out$
�
�*��eor_code_memory(key,memstart,length)
�� i,word
�� i = 0 � length � 4
�word = memstart!i
�memstart!i = word � key
�� i
��
�
)��eor_code_file(key,infile$,outfile$)

:� Encodes/decodes a file of any type using and EOR key
&� and saves scrambled file to disc
� length, infile, memstart
(4infile = �(infile$): length = �#infile: �#infile
2� memstart length
<%� "LOAD "+infile$+ " "+�~memstart
F)�eor_code_memory(key,memstart,length)
P3� "SAVE "+outfile$+" "+�~memstart+" +"+�~length
Z�
d
�
00000000  0d 00 0a 0e f4 20 3e 43  4f 44 45 4c 49 42 0d 00  |..... >CODELIB..|
00000010  14 04 0d 00 1e 16 dd f2  64 65 73 63 72 69 62 65  |........describe|
00000020  5f 63 6f 64 65 6c 69 62  0d 00 28 27 f1 20 22 46  |_codelib..('. "F|
00000030  4e 65 6e 63 6f 64 65 5f  63 61 65 73 61 72 28 63  |Nencode_caesar(c|
00000040  6f 64 65 24 2c 6d 65 73  73 61 67 65 24 29 22 0d  |ode$,message$)".|
00000050  00 32 27 f1 20 22 46 4e  64 65 63 6f 64 65 5f 63  |.2'. "FNdecode_c|
00000060  61 65 73 61 72 28 63 6f  64 65 24 2c 6d 65 73 73  |aesar(code$,mess|
00000070  61 67 65 24 29 22 0d 00  3c 28 f1 20 22 46 4e 74  |age$)"..<(. "FNt|
00000080  65 78 74 5f 6b 65 79 5f  65 6e 63 6f 64 65 28 6b  |ext_key_encode(k|
00000090  65 79 24 2c 6d 65 73 73  61 67 65 24 29 22 0d 00  |ey$,message$)"..|
000000a0  46 28 f1 20 22 46 4e 74  65 78 74 5f 6b 65 79 5f  |F(. "FNtext_key_|
000000b0  64 65 63 6f 64 65 28 6b  65 79 24 2c 6d 65 73 73  |decode(key$,mess|
000000c0  61 67 65 24 29 22 0d 00  50 29 f1 20 22 46 4e 6e  |age$)"..P). "FNn|
000000d0  75 6d 62 65 72 5f 6b 65  79 5f 65 6e 63 6f 64 65  |umber_key_encode|
000000e0  28 6b 65 79 2c 6d 65 73  73 61 67 65 24 29 22 0d  |(key,message$)".|
000000f0  00 5a 30 f1 20 22 50 52  4f 43 65 6f 72 5f 63 6f  |.Z0. "PROCeor_co|
00000100  64 65 5f 6d 65 6d 6f 72  79 28 6b 65 79 2c 6d 65  |de_memory(key,me|
00000110  6d 73 74 61 72 74 2c 6c  65 6e 67 74 68 29 22 0d  |mstart,length)".|
00000120  00 64 2f f1 20 22 50 52  4f 43 65 6f 72 5f 63 6f  |.d/. "PROCeor_co|
00000130  64 65 5f 66 69 6c 65 28  6b 65 79 2c 69 6e 66 69  |de_file(key,infi|
00000140  6c 65 24 2c 6f 75 74 66  69 6c 65 24 29 22 0d 00  |le$,outfile$)"..|
00000150  6e 05 e1 0d 00 78 04 0d  00 82 04 0d 00 8c 23 dd  |n....x........#.|
00000160  a4 65 6e 63 6f 64 65 5f  63 61 65 73 61 72 28 63  |.encode_caesar(c|
00000170  6f 64 65 24 2c 6d 65 73  73 61 67 65 24 29 0d 00  |ode$,message$)..|
00000180  96 32 f4 20 45 6e 63 6f  64 65 73 20 73 74 72 69  |.2. Encodes stri|
00000190  6e 67 20 75 73 69 6e 67  20 43 61 65 73 61 72 69  |ng using Caesari|
000001a0  61 6e 20 6c 65 74 74 65  72 20 63 79 70 68 65 72  |an letter cypher|
000001b0  0d 00 a0 26 ea 20 6c 2c  6e 2c 73 68 69 66 74 2c  |...&. l,n,shift,|
000001c0  62 61 73 65 2c 65 6e 64  2c 63 6f 64 65 2c 61 73  |base,end,code,as|
000001d0  63 2c 6f 75 74 24 0d 00  aa 0f 6e 3d a9 6d 65 73  |c,out$....n=.mes|
000001e0  73 61 67 65 24 0d 00 b4  20 62 61 73 65 20 3d 20  |sage$... base = |
000001f0  97 28 22 41 22 29 3a 20  65 6e 64 20 3d 20 62 61  |.("A"): end = ba|
00000200  73 65 2b 32 35 0d 00 be  13 63 6f 64 65 20 3d 20  |se+25....code = |
00000210  97 28 63 6f 64 65 24 29  0d 00 c8 45 e7 20 63 6f  |.(code$)...E. co|
00000220  64 65 20 3c 62 61 73 65  20 84 20 63 6f 64 65 20  |de <base . code |
00000230  3e 65 6e 64 20 8c 20 85  20 39 39 2c 22 43 41 45  |>end . . 99,"CAE|
00000240  53 41 52 20 43 4f 44 45  20 4f 55 54 20 4f 46 20  |SAR CODE OUT OF |
00000250  52 41 4e 47 45 20 41 20  54 4f 20 5a 22 0d 00 d2  |RANGE A TO Z"...|
00000260  17 73 68 69 66 74 20 3d  20 63 6f 64 65 20 2d 20  |.shift = code - |
00000270  62 61 73 65 0d 00 dc 0b  6f 75 74 24 3d 22 22 0d  |base....out$="".|
00000280  00 e6 0f e3 20 6c 20 3d  20 31 20 b8 20 6e 0d 00  |.... l = 1 . n..|
00000290  f0 1b 61 73 63 20 3d 20  97 28 c1 6d 65 73 73 61  |..asc = .(.messa|
000002a0  67 65 24 2c 6c 2c 31 29  29 0d 00 fa 20 e7 20 61  |ge$,l,1))... . a|
000002b0  73 63 20 3e 3d 20 62 61  73 65 20 8c 20 61 73 63  |sc >= base . asc|
000002c0  20 2b 3d 20 73 68 69 66  74 0d 01 04 1b e7 20 61  | += shift..... a|
000002d0  73 63 20 3e 20 65 6e 64  20 8c 20 61 73 63 20 2d  |sc > end . asc -|
000002e0  3d 20 32 36 0d 01 0e 10  6f 75 74 24 20 2b 3d 20  |= 26....out$ += |
000002f0  bd 61 73 63 0d 01 18 07  ed 20 6c 0d 01 22 09 3d  |.asc..... l..".=|
00000300  6f 75 74 24 0d 01 2c 04  0d 01 36 23 dd a4 64 65  |out$..,...6#..de|
00000310  63 6f 64 65 5f 63 61 65  73 61 72 28 63 6f 64 65  |code_caesar(code|
00000320  24 2c 6d 65 73 73 61 67  65 24 29 0d 01 40 32 f4  |$,message$)..@2.|
00000330  20 44 65 63 6f 64 65 73  20 73 74 72 69 6e 67 20  | Decodes string |
00000340  75 73 69 6e 67 20 43 61  65 73 61 72 69 61 6e 20  |using Caesarian |
00000350  6c 65 74 74 65 72 20 63  79 70 68 65 72 0d 01 4a  |letter cypher..J|
00000360  26 ea 20 6c 2c 6e 2c 73  68 69 66 74 2c 62 61 73  |&. l,n,shift,bas|
00000370  65 2c 65 6e 64 2c 63 6f  64 65 2c 61 73 63 2c 6f  |e,end,code,asc,o|
00000380  75 74 24 0d 01 54 0f 6e  3d a9 6d 65 73 73 61 67  |ut$..T.n=.messag|
00000390  65 24 0d 01 5e 20 62 61  73 65 20 3d 20 97 28 22  |e$..^ base = .("|
000003a0  41 22 29 3a 20 65 6e 64  20 3d 20 62 61 73 65 2b  |A"): end = base+|
000003b0  32 35 0d 01 68 13 63 6f  64 65 20 3d 20 97 28 63  |25..h.code = .(c|
000003c0  6f 64 65 24 29 0d 01 72  45 e7 20 63 6f 64 65 20  |ode$)..rE. code |
000003d0  3c 62 61 73 65 20 84 20  63 6f 64 65 20 3e 65 6e  |<base . code >en|
000003e0  64 20 8c 20 85 20 39 39  2c 22 43 41 45 53 41 52  |d . . 99,"CAESAR|
000003f0  20 43 4f 44 45 20 4f 55  54 20 4f 46 20 52 41 4e  | CODE OUT OF RAN|
00000400  47 45 20 41 20 54 4f 20  5a 22 0d 01 7c 17 73 68  |GE A TO Z"..|.sh|
00000410  69 66 74 20 3d 20 63 6f  64 65 20 2d 20 62 61 73  |ift = code - bas|
00000420  65 0d 01 86 0b 6f 75 74  24 3d 22 22 0d 01 90 0f  |e....out$=""....|
00000430  e3 20 6c 20 3d 20 31 20  b8 20 6e 0d 01 9a 1b 61  |. l = 1 . n....a|
00000440  73 63 20 3d 20 97 28 c1  6d 65 73 73 61 67 65 24  |sc = .(.message$|
00000450  2c 6c 2c 31 29 29 0d 01  a4 13 e7 20 61 73 63 20  |,l,1))..... asc |
00000460  3e 3d 20 62 61 73 65 20  8c 0d 01 ae 10 61 73 63  |>= base .....asc|
00000470  20 2d 3d 20 73 68 69 66  74 0d 01 b8 1c e7 20 61  | -= shift..... a|
00000480  73 63 20 3c 20 62 61 73  65 20 8c 20 61 73 63 20  |sc < base . asc |
00000490  2b 3d 20 32 36 0d 01 c2  05 cd 0d 01 cc 10 6f 75  |+= 26.........ou|
000004a0  74 24 20 2b 3d 20 bd 61  73 63 0d 01 d6 07 ed 20  |t$ += .asc..... |
000004b0  6c 0d 01 e0 09 3d 6f 75  74 24 0d 01 ea 04 0d 01  |l....=out$......|
000004c0  f4 24 dd a4 74 65 78 74  5f 6b 65 79 5f 65 6e 63  |.$..text_key_enc|
000004d0  6f 64 65 28 6b 65 79 24  2c 6d 65 73 73 61 67 65  |ode(key$,message|
000004e0  24 29 0d 01 fe 40 f4 20  45 6e 63 6f 64 65 73 20  |$)...@. Encodes |
000004f0  73 74 72 69 6e 67 20 75  73 69 6e 67 20 73 75 63  |string using suc|
00000500  63 65 73 73 69 6f 6e 20  6f 66 20 43 61 65 73 61  |cession of Caesa|
00000510  72 69 61 6e 20 63 6f 64  65 73 20 64 65 72 69 76  |rian codes deriv|
00000520  65 64 0d 02 08 15 f4 20  66 72 6f 6d 20 61 20 74  |ed..... from a t|
00000530  65 78 74 20 6b 65 79 0d  02 12 2d ea 20 6b 6e 2c  |ext key...-. kn,|
00000540  6b 63 6f 75 6e 74 2c 63  6f 64 65 24 2c 6f 75 74  |kcount,code$,out|
00000550  24 2c 6d 6e 2c 6d 63 6f  75 6e 74 2c 61 73 63 2c  |$,mn,mcount,asc,|
00000560  62 61 73 65 0d 02 1c 11  62 61 73 65 20 3d 20 97  |base....base = .|
00000570  28 22 41 22 29 0d 02 26  0e 6b 6e 20 3d 20 a9 6b  |("A")..&.kn = .k|
00000580  65 79 24 0d 02 30 0e 6b  63 6f 75 6e 74 20 3d 20  |ey$..0.kcount = |
00000590  30 0d 02 3a 12 6d 6e 20  3d 20 a9 6d 65 73 73 61  |0..:.mn = .messa|
000005a0  67 65 24 0d 02 44 0e 6d  63 6f 75 6e 74 20 3d 20  |ge$..D.mcount = |
000005b0  30 0d 02 4e 12 c8 95 20  6d 63 6f 75 6e 74 20 3c  |0..N... mcount <|
000005c0  20 6d 6e 0d 02 58 0e 6d  63 6f 75 6e 74 20 2b 3d  | mn..X.mcount +=|
000005d0  31 0d 02 62 05 f5 0d 02  6c 0e 6b 63 6f 75 6e 74  |1..b....l.kcount|
000005e0  20 2b 3d 31 0d 02 76 1e  e7 20 6b 63 6f 75 6e 74  | +=1..v.. kcount|
000005f0  20 3e 20 6b 6e 20 8c 20  6b 63 6f 75 6e 74 20 3d  | > kn . kcount =|
00000600  20 31 0d 02 80 1c 61 73  63 20 3d 20 97 28 c1 6b  | 1....asc = .(.k|
00000610  65 79 24 2c 6b 63 6f 75  6e 74 2c 31 29 29 0d 02  |ey$,kcount,1))..|
00000620  8a 11 fd 20 61 73 63 20  3e 3d 20 62 61 73 65 0d  |... asc >= base.|
00000630  02 94 10 63 6f 64 65 24  20 3d 20 bd 61 73 63 0d  |...code$ = .asc.|
00000640  02 9e 35 6f 75 74 24 20  2b 3d 20 a4 65 6e 63 6f  |..5out$ += .enco|
00000650  64 65 5f 63 61 65 73 61  72 28 63 6f 64 65 24 2c  |de_caesar(code$,|
00000660  c1 6d 65 73 73 61 67 65  24 2c 6d 63 6f 75 6e 74  |.message$,mcount|
00000670  2c 31 29 29 0d 02 a8 05  ce 0d 02 b2 09 3d 6f 75  |,1)).........=ou|
00000680  74 24 0d 02 bc 04 0d 02  c6 24 dd a4 74 65 78 74  |t$.......$..text|
00000690  5f 6b 65 79 5f 64 65 63  6f 64 65 28 6b 65 79 24  |_key_decode(key$|
000006a0  2c 6d 65 73 73 61 67 65  24 29 0d 02 d0 40 f4 20  |,message$)...@. |
000006b0  44 65 63 6f 64 65 73 20  73 74 72 69 6e 67 20 75  |Decodes string u|
000006c0  73 69 6e 67 20 73 75 63  63 65 73 73 69 6f 6e 20  |sing succession |
000006d0  6f 66 20 43 61 65 73 61  72 69 61 6e 20 63 6f 64  |of Caesarian cod|
000006e0  65 73 20 64 65 72 69 76  65 64 0d 02 da 15 f4 20  |es derived..... |
000006f0  66 72 6f 6d 20 61 20 74  65 78 74 20 6b 65 79 0d  |from a text key.|
00000700  02 e4 2d ea 20 6b 6e 2c  6b 63 6f 75 6e 74 2c 63  |..-. kn,kcount,c|
00000710  6f 64 65 24 2c 6f 75 74  24 2c 6d 6e 2c 6d 63 6f  |ode$,out$,mn,mco|
00000720  75 6e 74 2c 61 73 63 2c  62 61 73 65 0d 02 ee 11  |unt,asc,base....|
00000730  62 61 73 65 20 3d 20 97  28 22 41 22 29 0d 02 f8  |base = .("A")...|
00000740  0e 6b 6e 20 3d 20 a9 6b  65 79 24 0d 03 02 0e 6b  |.kn = .key$....k|
00000750  63 6f 75 6e 74 20 3d 20  30 0d 03 0c 12 6d 6e 20  |count = 0....mn |
00000760  3d 20 a9 6d 65 73 73 61  67 65 24 0d 03 16 0e 6d  |= .message$....m|
00000770  63 6f 75 6e 74 20 3d 20  30 0d 03 20 12 c8 95 20  |count = 0.. ... |
00000780  6d 63 6f 75 6e 74 20 3c  20 6d 6e 0d 03 2a 0e 6d  |mcount < mn..*.m|
00000790  63 6f 75 6e 74 20 2b 3d  31 0d 03 34 05 f5 0d 03  |count +=1..4....|
000007a0  3e 0e 6b 63 6f 75 6e 74  20 2b 3d 31 0d 03 48 1e  |>.kcount +=1..H.|
000007b0  e7 20 6b 63 6f 75 6e 74  20 3e 20 6b 6e 20 8c 20  |. kcount > kn . |
000007c0  6b 63 6f 75 6e 74 20 3d  20 31 0d 03 52 1c 61 73  |kcount = 1..R.as|
000007d0  63 20 3d 20 97 28 c1 6b  65 79 24 2c 6b 63 6f 75  |c = .(.key$,kcou|
000007e0  6e 74 2c 31 29 29 0d 03  5c 11 fd 20 61 73 63 20  |nt,1))..\.. asc |
000007f0  3e 3d 20 62 61 73 65 0d  03 66 10 63 6f 64 65 24  |>= base..f.code$|
00000800  20 3d 20 bd 61 73 63 0d  03 70 35 6f 75 74 24 20  | = .asc..p5out$ |
00000810  2b 3d 20 a4 64 65 63 6f  64 65 5f 63 61 65 73 61  |+= .decode_caesa|
00000820  72 28 63 6f 64 65 24 2c  c1 6d 65 73 73 61 67 65  |r(code$,.message|
00000830  24 2c 6d 63 6f 75 6e 74  2c 31 29 29 0d 03 7a 05  |$,mcount,1))..z.|
00000840  ce 0d 03 84 09 3d 6f 75  74 24 0d 03 8e 04 0d 03  |.....=out$......|
00000850  98 25 dd a4 6e 75 6d 62  65 72 5f 6b 65 79 5f 65  |.%..number_key_e|
00000860  6e 63 6f 64 65 28 6b 65  79 2c 6d 65 73 73 61 67  |ncode(key,messag|
00000870  65 24 29 0d 03 a2 40 f4  20 45 6e 63 6f 64 65 73  |e$)...@. Encodes|
00000880  20 73 74 72 69 6e 67 20  75 73 69 6e 67 20 73 75  | string using su|
00000890  63 63 65 73 73 69 6f 6e  20 6f 66 20 43 61 65 73  |ccession of Caes|
000008a0  61 72 69 61 6e 20 63 6f  64 65 73 20 64 65 72 69  |arian codes deri|
000008b0  76 65 64 0d 03 ac 3c f4  20 66 72 6f 6d 20 61 20  |ved...<. from a |
000008c0  6e 75 6d 65 72 69 63 20  6b 65 79 20 73 65 65 64  |numeric key seed|
000008d0  20 74 6f 20 73 65 74 20  72 61 6e 64 6f 6d 20 6e  | to set random n|
000008e0  75 6d 62 65 72 20 67 65  6e 65 72 61 74 6f 72 0d  |umber generator.|
000008f0  03 b6 2a ea 20 6d 6e 2c  20 6d 63 6f 75 6e 74 2c  |..*. mn, mcount,|
00000900  20 62 61 73 65 2c 20 6f  75 74 24 2c 20 64 75 6d  | base, out$, dum|
00000910  6d 79 2c 20 63 6f 64 65  24 0d 03 c0 0f 62 61 73  |my, code$....bas|
00000920  65 20 3d 20 97 22 41 22  0d 03 ca 12 6d 6e 20 3d  |e = ."A"....mn =|
00000930  20 a9 6d 65 73 73 61 67  65 24 0d 03 d4 0b 6f 75  | .message$....ou|
00000940  74 24 3d 22 22 0d 03 de  13 64 75 6d 6d 79 20 3d  |t$=""....dummy =|
00000950  20 b3 28 2d 6b 65 79 29  0d 03 e8 15 e3 20 6d 63  | .(-key)..... mc|
00000960  6f 75 6e 74 20 3d 20 31  20 b8 20 6d 6e 0d 03 f2  |ount = 1 . mn...|
00000970  1b 63 6f 64 65 24 20 3d  20 bd 28 62 61 73 65 2b  |.code$ = .(base+|
00000980  b3 28 32 36 29 2d 31 29  0d 03 fc 35 6f 75 74 24  |.(26)-1)...5out$|
00000990  20 2b 3d 20 a4 65 6e 63  6f 64 65 5f 63 61 65 73  | += .encode_caes|
000009a0  61 72 28 63 6f 64 65 24  2c c1 6d 65 73 73 61 67  |ar(code$,.messag|
000009b0  65 24 2c 6d 63 6f 75 6e  74 2c 31 29 29 0d 04 06  |e$,mcount,1))...|
000009c0  0c ed 20 6d 63 6f 75 6e  74 0d 04 10 09 3d 6f 75  |.. mcount....=ou|
000009d0  74 24 0d 04 1a 04 0d 04  24 25 dd a4 6e 75 6d 62  |t$......$%..numb|
000009e0  65 72 5f 6b 65 79 5f 64  65 63 6f 64 65 28 6b 65  |er_key_decode(ke|
000009f0  79 2c 6d 65 73 73 61 67  65 24 29 0d 04 2e 40 f4  |y,message$)...@.|
00000a00  20 44 65 63 6f 64 65 73  20 73 74 72 69 6e 67 20  | Decodes string |
00000a10  75 73 69 6e 67 20 73 75  63 63 65 73 73 69 6f 6e  |using succession|
00000a20  20 6f 66 20 43 61 65 73  61 72 69 61 6e 20 63 6f  | of Caesarian co|
00000a30  64 65 73 20 64 65 72 69  76 65 64 0d 04 38 3c f4  |des derived..8<.|
00000a40  20 66 72 6f 6d 20 61 20  6e 75 6d 65 72 69 63 20  | from a numeric |
00000a50  6b 65 79 20 73 65 65 64  20 74 6f 20 73 65 74 20  |key seed to set |
00000a60  72 61 6e 64 6f 6d 20 6e  75 6d 62 65 72 20 67 65  |random number ge|
00000a70  6e 65 72 61 74 6f 72 0d  04 42 2a ea 20 6d 6e 2c  |nerator..B*. mn,|
00000a80  20 6d 63 6f 75 6e 74 2c  20 62 61 73 65 2c 20 6f  | mcount, base, o|
00000a90  75 74 24 2c 20 64 75 6d  6d 79 2c 20 63 6f 64 65  |ut$, dummy, code|
00000aa0  24 0d 04 4c 0f 62 61 73  65 20 3d 20 97 22 41 22  |$..L.base = ."A"|
00000ab0  0d 04 56 12 6d 6e 20 3d  20 a9 6d 65 73 73 61 67  |..V.mn = .messag|
00000ac0  65 24 0d 04 60 0b 6f 75  74 24 3d 22 22 0d 04 6a  |e$..`.out$=""..j|
00000ad0  13 64 75 6d 6d 79 20 3d  20 b3 28 2d 6b 65 79 29  |.dummy = .(-key)|
00000ae0  0d 04 74 15 e3 20 6d 63  6f 75 6e 74 20 3d 20 31  |..t.. mcount = 1|
00000af0  20 b8 20 6d 6e 0d 04 7e  1b 63 6f 64 65 24 20 3d  | . mn..~.code$ =|
00000b00  20 bd 28 62 61 73 65 2b  b3 28 32 36 29 2d 31 29  | .(base+.(26)-1)|
00000b10  0d 04 88 35 6f 75 74 24  20 2b 3d 20 a4 64 65 63  |...5out$ += .dec|
00000b20  6f 64 65 5f 63 61 65 73  61 72 28 63 6f 64 65 24  |ode_caesar(code$|
00000b30  2c c1 6d 65 73 73 61 67  65 24 2c 6d 63 6f 75 6e  |,.message$,mcoun|
00000b40  74 2c 31 29 29 0d 04 92  0c ed 20 6d 63 6f 75 6e  |t,1))..... mcoun|
00000b50  74 0d 04 9c 09 3d 6f 75  74 24 0d 04 a6 04 0d 04  |t....=out$......|
00000b60  b0 2a dd f2 65 6f 72 5f  63 6f 64 65 5f 6d 65 6d  |.*..eor_code_mem|
00000b70  6f 72 79 28 6b 65 79 2c  6d 65 6d 73 74 61 72 74  |ory(key,memstart|
00000b80  2c 6c 65 6e 67 74 68 29  0d 04 ba 0c ea 20 69 2c  |,length)..... i,|
00000b90  77 6f 72 64 0d 04 c4 18  e3 20 69 20 3d 20 30 20  |word..... i = 0 |
00000ba0  b8 20 6c 65 6e 67 74 68  20 88 20 34 0d 04 ce 15  |. length . 4....|
00000bb0  77 6f 72 64 20 3d 20 6d  65 6d 73 74 61 72 74 21  |word = memstart!|
00000bc0  69 0d 04 d8 1b 6d 65 6d  73 74 61 72 74 21 69 20  |i....memstart!i |
00000bd0  3d 20 77 6f 72 64 20 82  20 6b 65 79 0d 04 e2 07  |= word . key....|
00000be0  ed 20 69 0d 04 ec 05 e1  0d 04 f6 04 0d 05 00 29  |. i............)|
00000bf0  dd f2 65 6f 72 5f 63 6f  64 65 5f 66 69 6c 65 28  |..eor_code_file(|
00000c00  6b 65 79 2c 69 6e 66 69  6c 65 24 2c 6f 75 74 66  |key,infile$,outf|
00000c10  69 6c 65 24 29 0d 05 0a  3a f4 20 45 6e 63 6f 64  |ile$)...:. Encod|
00000c20  65 73 2f 64 65 63 6f 64  65 73 20 61 20 66 69 6c  |es/decodes a fil|
00000c30  65 20 6f 66 20 61 6e 79  20 74 79 70 65 20 75 73  |e of any type us|
00000c40  69 6e 67 20 61 6e 64 20  45 4f 52 20 6b 65 79 0d  |ing and EOR key.|
00000c50  05 14 26 f4 20 61 6e 64  20 73 61 76 65 73 20 73  |..&. and saves s|
00000c60  63 72 61 6d 62 6c 65 64  20 66 69 6c 65 20 74 6f  |crambled file to|
00000c70  20 64 69 73 63 0d 05 1e  1e ea 20 6c 65 6e 67 74  | disc..... lengt|
00000c80  68 2c 20 69 6e 66 69 6c  65 2c 20 6d 65 6d 73 74  |h, infile, memst|
00000c90  61 72 74 0d 05 28 34 69  6e 66 69 6c 65 20 3d 20  |art..(4infile = |
00000ca0  8e 28 69 6e 66 69 6c 65  24 29 3a 20 6c 65 6e 67  |.(infile$): leng|
00000cb0  74 68 20 3d 20 a2 23 69  6e 66 69 6c 65 3a 20 d9  |th = .#infile: .|
00000cc0  23 69 6e 66 69 6c 65 0d  05 32 15 de 20 6d 65 6d  |#infile..2.. mem|
00000cd0  73 74 61 72 74 20 6c 65  6e 67 74 68 0d 05 3c 25  |start length..<%|
00000ce0  ff 20 22 4c 4f 41 44 20  22 2b 69 6e 66 69 6c 65  |. "LOAD "+infile|
00000cf0  24 2b 20 22 20 22 2b c3  7e 6d 65 6d 73 74 61 72  |$+ " "+.~memstar|
00000d00  74 0d 05 46 29 f2 65 6f  72 5f 63 6f 64 65 5f 6d  |t..F).eor_code_m|
00000d10  65 6d 6f 72 79 28 6b 65  79 2c 6d 65 6d 73 74 61  |emory(key,memsta|
00000d20  72 74 2c 6c 65 6e 67 74  68 29 0d 05 50 33 ff 20  |rt,length)..P3. |
00000d30  22 53 41 56 45 20 22 2b  6f 75 74 66 69 6c 65 24  |"SAVE "+outfile$|
00000d40  2b 22 20 22 2b c3 7e 6d  65 6d 73 74 61 72 74 2b  |+" "+.~memstart+|
00000d50  22 20 2b 22 2b c3 7e 6c  65 6e 67 74 68 0d 05 5a  |" +"+.~length..Z|
00000d60  05 e1 0d 05 64 04 0d ff                           |....d...|
00000d68