w="keep your secrets secret ;)"
m=""
c=""
cW=""
d=""
o=""
e=""
co = 31786
live = function()
outer.cW = input("input codeword")
loop(cW)
end function
loop = function(cW)
print "enter ""en:"" or ""de:"" at start of message or (q)uit"
k = input("")
if cW then
if k[0] == "e" then
m = m + k[3:]
en(m,cW,false)
loop(cW)
else if k[0] == "d" then
for i in cW
j=code(i)
j=j+97
c = c + char(j)
end for
m = c + char(co) + k[3:]
de(m)
loop(cW)
else if k[0] == "q" then
home
end if
end if
end function
en = function(m,cW,p)
for i in m.indexes
a = str(cW[i%cW.len])
b = str(m[i])
c = code(a) + code(b)
d = d + char(c)
end for
for i in cW
e=code(i)
e=e+97
o = o + char(e)
end for
if p == true then
print o+char(co)+d
else if p == false then
print d
end if
end function
de = function(e)
if not e.indexOf(char(co)) then
c = input("codeword: ")
for i in c
j=code(i)
j=j+97
cW = cW + char(j)
end for
m = e
else if e.indexOf(char(co)) then
cW = slice(e,0,e.indexOf(char(co)))
m = slice(e,e.indexOf(char(co))+1,e.len)
end if
for i in m.indexes
a = code(m[i])
b = code(cW[i%cW.len])
c = a-b
d = d + char(c+97)
end for
print"message: "+ d
end function
quit = function
print "GoodBye"
end function
home = function()
print " "
s = input ("(e)ncrypt : (d)ecrypt : (l)ive : (q)uit")
if s == "e" then
l = input ("Security level: (1),(2),(3)")
m = input("message: ")
if l == "1" then
cW = char(100)
en(m,cW,true)
else if l == "2" then
cW = input("codeword: ")
en(m,cW,true)
else if l == "3" then
cW = input("codeword: ")
en(m,cW,false)
end if
print ""
else if s == "d" then
e = input("input encrypted code: ")
de(e)
else if s == "l" then
print "copying data: select,ctrl+c,release mouse"
live
else if s == "q" then
quit
end if
end function
print"welcome to EnDeString"
print"keep your secrets secret"
print"no numbers please"
home