31 lines
661 B
Plaintext
31 lines
661 B
Plaintext
# Caeser Cipher
|
|
# basic256 1.1.4.0
|
|
|
|
dec$ = ""
|
|
type$ = "cleartext "
|
|
|
|
input "If decrypting enter " + "<d> " + " -- else press enter > ",dec$ # it's a klooj I know...
|
|
input "Enter offset > ", iOffset
|
|
|
|
if dec$ = "d" then
|
|
iOffset = 26 - iOffset
|
|
type$ = "ciphertext "
|
|
end if
|
|
|
|
input "Enter " + type$ + "> ", str$
|
|
|
|
str$ = upper(str$) # a bit of a cheat really, however old school encryption is always upper case
|
|
len = length(str$)
|
|
|
|
for i = 1 to len
|
|
iTemp = asc(mid(str$,i,1))
|
|
|
|
if iTemp > 64 AND iTemp < 91 then
|
|
iTemp = ((iTemp - 65) + iOffset) % 26
|
|
print chr(iTemp + 65);
|
|
else
|
|
print chr(iTemp);
|
|
end if
|
|
|
|
next i
|