1 REM +++++++++++++++++++++++++++++++++
2 REM ! Program .... KRYPTO.CAS
3 REM ! av      ??
4 REM ! Minne 16 kbytes f|r kassett
5 REM ! konv.till kas av <2401>87.01.14
6 REM +++++++++++++++++++++++++++++++++ 
7 REM Krypterar/dekrypterar textfiler
8 REM 
10 R%=90% : REM max antal rader f|r KASSETT-bruk
20 DIM A$(R%)=119,B$=119
30 ; "S{tt kassett f|r avspelning !" : ; "Infil:"; : INPUT F1$
40 ; "Kryptering eller dekryptering? (K/D)"
50 GET C$
60 IF (ASC(C$) AND 223%)=75 THEN Y%=1% ELSE IF (ASC(C$) AND 223%)=68% THEN Y%=0% ELSE 50
70 X%=95%
80 IF Y% THEN ; "Kryptering!" ELSE ; "Dekryptering"
90 ; "Giv startnyckel (10tkn) :";
100 FOR I%=1 TO 5
110 GET A$ : ; A$; : GET B$ : ; B$; : POKE -456%+I%,ASC(A$)+ASC(B$)
120 NEXT I%
130 OPEN F1$ ASFILE 1%
150 ONERRORGOTO 270
160 FOR I%=1 TO R%
170 INPUTLINE #1%,B$ : B$=LEFT$(B$,LEN(B$)-2%) : ; B$
180 A$=""
190 FOR J%=1 TO LEN(B$)
200 Z0%=X%*RND
210 IF Y% THEN Z%=ASC(RIGHT$(B$,J%))+Z0% ELSE Z%=ASC(RIGHT$(B$,J%))-Z0%
220 IF Z%>126% THEN Z%=Z%-X% ELSE IF Z%<32% THEN Z%=Z%+X%
230 A$(I%)=A$(I%)+CHR$(Z%)
240 NEXT J% : ; A$(I%)
260 NEXT I% : ; : ; "Filen l{ngre {n"R%" rader !" : STOP 
270 IF ERRCODE=34 THEN CLOSE 1 ELSE ; : ; "Fel nr";ERRCODE : STOP 
280 ; "S{tt kassett f|r inspelning !" : ; "Utfil:"; : INPUT F1$
300 PREPARE F1$ ASFILE 2%
310 FOR J%=1% TO I% : ; #2%,A$(J%) : NEXT J% : CLOSE 2%
