Cypher

Date: 198x
Type: Program
Platform(s): TS 1000

Appears on

Assembled by Tim Ward from many sources. Contains programs 10176 – 10210.

Gallery

Cypher

Source Code

  10 REM "CYPHER"
  40 FAST 
  50 DIM A(26,26)
  60 LET J=-1
  70 FOR I=1 TO 26
  80 LET J=J+1
  90 FOR K=1 TO 26
 100 LET A(I,K)=K+J
 110 IF A(I,K)>26 THEN LET A(I,K)=A(I,K)-26
 120 NEXT K
 130 NEXT I
 150 PRINT 
 160 PRINT 
 170 SLOW 
 180 PRINT " ENTER KEYWORD"
 190 INPUT K$
 200 PRINT K$
 210 PRINT 
 220 PRINT " ENTER MESSAGE"
 230 INPUT M$
 240 PRINT M$
 250 PRINT 
 260 PRINT " ENCYPHER/DECYPHER? (ENTER E OR D)"
 270 INPUT Q$
 280 PRINT 
 290 IF Q$="E" THEN GOTO 320
 300 IF Q$="D" THEN GOTO 440
 310 IF Q$<>"E" OR Q$<>"D" THEN GOTO 260
 330 FAST 
 340 PRINT " ENCYPHERED MESSAGE READS:-"
 350 PRINT 
 360 LET S=0
 370 LET T=0
 380 LET S=S+1
 390 IF S>LEN K$ THEN LET S=S-LEN K$
 400 LET T=T+1
 410 PRINT CHR$ (37+A(CODE K$(S)-37,CODE M$(T)-37));
 420 IF T=LEN M$ THEN GOTO 140
 430 GOTO 380
 450 FAST 
 460 LET Z=0
 470 PRINT " DECYPHERED MESSAGE READS:-"
 480 PRINT 
 490 FOR W=1 TO LEN M$
 500 LET Z=Z+1
 510 IF Z>LEN K$ THEN LET Z=Z-LEN K$
 520 FOR X=1 TO 26
 530 IF A(CODE K$(Z)-37,X)=CODE M$(W)-37 THEN PRINT CHR$ (X+37);
 540 NEXT X
 550 NEXT W
 560 GOTO 140
 570 SAVE "1017%7"
 580 RUN 

People

No people associated with this content.

Scroll to Top