22 lines
547 B
Plaintext
22 lines
547 B
Plaintext
a$="THIS IS MY TEXT TO ENCODE WITH CAESAR CIPHER"
|
|
Function Cipher$(a$, N) {
|
|
If Len(a$)=0 Then Exit
|
|
a$=Ucase$(a$)
|
|
\\ Integer in Mem is unsigned number
|
|
Buffer Mem as Integer*Len(a$)
|
|
Return Mem, 0:=a$
|
|
For i=0 to Len(a$)-1 {
|
|
If Eval(mem, i)>=65 and Eval(mem, i)<=90 then Return Mem, i:=(Eval(mem, i)-39+n) mod 26 + 65
|
|
}
|
|
=Eval$(Mem)
|
|
}
|
|
B$=Cipher$(a$, 10)
|
|
Print B$
|
|
Print Cipher$(B$,-10)
|
|
|
|
n=1 ' n negative or positive or zero
|
|
for i=65 to 65+25
|
|
a=(1+(i -64)+n+24) mod 26 + 65
|
|
? chr$(a),
|
|
next
|