22 lines
465 B
Plaintext
22 lines
465 B
Plaintext
CONST lc$ = "abcdefghijklmnopqrstuvwxyz"
|
|
CONST uc$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
CONST txt$ = "The quick brown fox jumps over the lazy dog."
|
|
|
|
FUNCTION Ceasar$(t$, k)
|
|
|
|
lk$ = MID$(lc$ & lc$, k+1, 26)
|
|
uk$ = MID$(uc$ & uc$, k+1, 26)
|
|
|
|
RETURN REPLACE$(t$, lc$ & uc$, lk$ & uk$, 2)
|
|
|
|
END FUNCTION
|
|
|
|
tokey = RANDOM(25)+1
|
|
PRINT "Encrypting text with key: ", tokey
|
|
|
|
en$ = Ceasar$(txt$, tokey)
|
|
|
|
PRINT "Encrypted: ", en$
|
|
PRINT "Decrypted: ", Ceasar$(en$, 26-tokey)
|