!get the device & ! 10310 COLON% = INSTR(1%,INFILE$,":") 10320 IF COLON% <> 0% & THEN DEV$ = LEFT(INFILE$,COLON%) \ & INFILE$ = RIGHT(INFILE$,COLON%+1%) 10400 ! & !add default extension, if needed & ! 10410 DOT% = INSTR(1%,INFILE$,".") 10420 IF DOT% = 0% & THEN INFILE$ = INFILE$ + ".TXT" 10430 INFILE$ = DEV$ + INFILE$ 10500 ! & !open it up & ! 10510 OPEN INFILE$ FOR INPUT AS FILE #1% & !error routine may branch to 10600 (can't find) or & !10700 (protection violation) 10520 GOTO 10900 10600 ! & !file not there & ! 10610 PRINT BELL$;"Can't find the input file: "; INFILE$ 10620 GOTO 10000 10700 ! & !protection violation & ! 10710 PRINT BELL$;"Can't access the input file: "; INFILE$ 10720 GOTO 10000 10900 ! & !return & ! 10990 RETURN 11000 ! & ! & ! SUBROUTINE: Open working file & ! & ! 11100 ! & !open it for output. If it is there, it is an error & ! 11110 WORKFILE$ = DEV$ + "DECODE.TMP" 11120 OPEN WORKFILE$ FOR INPUT AS FILE #2% & !an error will cause a branch to 10200 11130 PRINT "This program needs to use the file "; \ & PRINT WORKFILE$; " as a working file. Please" \ & PRINT "delete or rename the file by this name." \ & PRINT 11140 GOTO 32767 11200 ! & !file wasn't there (which is fine) & ! 11210 OPEN WORKFILE$ FOR OUTPUT AS FILE #2% 11900 ! & !return & ! 11990 RETURN 12000 ! & ! & ! SUBROUTINE: Initialize string & ! & ! 12100 ! & !set up the identity string (but with ^I and ^G reversed) & ! 12110 T%(I%) = I% FOR I% = 1% TO 127% 12120 T%(7%) = 9% \ & T%(9%) = 7% 12130 T%(0%) = 127% !length is needed for CHANGE to come later 12200 ! & !some fixed shuffling to avoid T%(I%) = I% & ! 12210 FOR I% = 0% TO 10% 12220 Z% = FNEXCHANGE%(32%+I%,98%+I%) 12230 Z% = FNEXCHANGE%(43%+I%,76%+I%) 12240 Z% = FNEXCHANGE%(54%+I%,109%+I%) 12250 Z% = FNEXCHANGE%(65%+I%,87%+I%) 12260 NEXT I% 12270 Z% = FNEXCHANGE%(120%+I%,124%+I%) FOR I% = 0% TO 2% 12300 ! & !shuffle more (dependent on password) & ! 12310 FOR SH% = 1% TO KN2% 12320 N% = N% + 1% 12330 JUNK% = RND & FOR I% = 1% TO ASCII( MID(PASS$,FNMOD%(N%),1%) ) / KN3% 12340 IND1% = FNRND% \ & IND2% = T%(IND1%) \ & IND3% = FNRND% \ & IND4% = T%(IND3%) 12350 Z% = FNEXCHANGE%(IND1%,IND3%) 12360 Z% = FNEXCHANGE%(IND2%,IND4%) 12370 NEXT SH% 12400 ! & !change to a string for XLATE & ! 12410 CHANGE T% TO T$ 12420 T$ = CHR$(0%) + T$ 12900 ! & !return & ! 12990 RETURN 13000 ! & ! & ! SUBROUTINE: update string & ! & ! 13100 ! & !some more shuffling & !(the vector version of the string is still intact, so we don't & !need to CHANGE T$ to T%) & ! 13110 FOR SH% = 1% TO KN1% 13120 N% = N% + 1% 13130 JUNK% = RND & FOR I% = 1% TO ASCII( MID(PASS$,FNMOD%(N%),1%) ) / KN3% 13140 IND1% = FNRND% \ & IND2% = T%(IND1%) \ & IND3% = FNRND% \ & IND4% = T%(IND3%) 13150 Z% = FNEXCHANGE%(IND1%,IND3%) 13160 Z% = FNEXCHANGE%(IND2%,IND4%) 13170 NEXT SH% 13200 ! & !change to string & ! 13210 CHANGE T% TO T$ 13220 T$ = CHR$(0%) + T$ 13900 ! & !return & ! 13990 RETURN 18000 ! & ! & ! FUNCTIONS & ! & ! 18100 ! & !find a number modulo length of password & ! 18110 DEF FNMOD%(N%) = N% - N% / LPASS% * LPASS% 18200 ! & !generate a random number in range 32 - 126 & ! 18210 DEF FNRND% 18220 JUNK% = RND FOR JNK% = 1% TO KN3% 18280 FNRND% = RND * 94% + 32% 18290 FNEND 18300 ! & !add random characters to password & ! 18310 DEF FNCODE$(P$) 18320 TP$ = "" 18330 FOR I% = 1% TO LEN(P$) 18340 TP$ = TP$ + MID(P$,I%,1%) + CHR$(FNRND%) 18350 NEXT I% 18380 FNCODE$ = TP$ 18390 FNEND 18400 ! & !exchange two DECODEBAS[.050021]DECODE.BAS[.050021]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddfelements of T%( ) & ! 18410 DEF FNEXCHANGE%(I%,J%) 18420 TIND% = T%(I%) \ & T%(I%) = T%(J%) \ & T%(J%) = TIND% 18480 FNEXCHANGE% = 0% 18490 FNEND 19000 ! & ! & ! Error Routine & ! & ! 19100 ! & !^C error & ! 19110 IF ERR = 28 & AND ERL = 9020 & THEN PRINT BELL$;"Original file is called ";INFILE$ \ & PRINT "Decoded file is called DECODE.TMP" \ & PRINT "Program was unable to rename files." \ & RESUME 32767 & !^C error while killing original 19120 IF ERR = 28 & AND ERL = 9030 & THEN PRINT BELL$;"Decoded file is called DECODE.TMP" \ & PRINT "Original file has been deleted." \ & PRINT "Program was unable to rename the file." \ & RESUME 32767 & !^C error while renaming coded file 19130 IF ERR = 28 & THEN PRINT BELL$;"Program aborted by ^C." \ & CLOSE #1%, #2% \ & KILL WORKFILE$ IF WORKFILE$ <> "" \ & RESUME 32767 & !general ^C error, return to original file 19200 ! & !Expected errors (by line number) & ! 19210 IF ERL = 19130 & THEN RESUME 32767 & !couldn't kill work file in error routine (^C) 19220 IF ERL = 5010 THEN RESUME 9000 & !end of file on input 19230 IF ERL = 11120 THEN RESUME 11200 & !working file wasn't there 19240 IF ERL = 3050 AND ERR = 11 THEN RESUME 9000 & !^Z on password accepted as a quit 19250 IF ERL = 10510 AND ERR = 5 THEN RESUME 10600 & !can't find input file 19260 IF ERL = 10510 AND ERR = 10 THEN RESUME 10700 & !protection violation for input file 19270 IF ERL = 9030 & THEN PRINT BELL$;"Unable to rename file. Decoded copy is named "; WORKFILE$ \ & GOTO 32767 19280 IF ERL = 4080 THEN RESUME 32767 & !couldn't kill work file (wrong password exit) 19600 ! & !Expected errors (by type) & ! 19900 ! & !Unexpected errors & ! 19910 Z$ = SYS(CHR$(6%)+CHR$(9%)+CHR$(ERR)) 19920 ERROR$ = RIGHT(Z$,3%) 19930 PRINT " ***** Whoops! *****" \ & PRINT " "; ERROR$; " at line";ERL 19990 GOTO 32767 32767 Z$ = SYS(CHR$(9%)) \ & END