sdfgwTop 50 PosterJoin Date: 2009-01-08 Post Count: 41681 |
Strings r win. :P
Check this out, my most 1337 string script EVA
_G.limit = function (num, lim)
if num >= lim + 1 then
num = limit(num-lim, lim)
elseif num <= 0 then
num = limit(num+lim, lim)
end
return num
end
_G.cipher = {
alphabet = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"},
alphabetTo = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"},
number = function (let)
for i = 1,#cipher.alphabet do
if cipher.alphabet[i] == string.upper(let) then
print("Converted " .. let .. " to " .. tostring(i))
return i
end
end
end,
letter = function (num)
let = cipher.alphabetTo[num]
print("Converted " .. tostring(num) .. " to " .. let)
return let
end,
shift = function (let, key)
print("Shifting " .. let .. " and " .. key)
p = cipher.number(let)
if (p~=nil) then
num = p+cipher.number(key)-1
lim = limit(num, #cipher.alphabet)
return cipher.letter(lim)
end
end,
antishift = function (let, key)
print("Antishifting " .. let .. " and " .. key)
p = cipher.number(let)
if (p~=nil) then
num = p-cipher.number(key)+1
lim = limit(num, #cipher.alphabet)
return cipher.letter(lim)
end
end,
encode = function (msg, key)
up = string.upper(msg)
code = ""
for i = 1,#up do
let = string.sub(up, i, i)
num = limit(i, #key)
ciph = string.sub(key, num, num)
hm = cipher.shift(let, ciph)
if hm == nil then
hm = let
end
code = code .. hm
end
return code
end,
decode = function (msg, key)
up = string.upper(msg)
code = ""
for i = 1,#up do
let = string.sub(up, i, i)
num = limit(i, #key)
ciph = string.sub(key, num, num)
hm = cipher.antishift(let, ciph)
if hm == nil then
hm = let
end
code = code .. hm
end
return string.lower(code)
end,
anagram = function (msg, keynum)
code = ""
no = math.ceil(#msg/#keynum)
print(no)
for i = 1, no do
tab = {}
str = string.sub(msg, (#keynum*i)-#keynum+1, i*#keynum)
print(str)
for v = 1,#str do
point = tonumber(string.sub(keynum, v, v))
print(point)
tab[point] = string.sub(str, v, v)
end
code = code .. table.concat(tab)
end
return code
end
}
This is mah ultimate cipher script. To use, you pick a key word and encode a message like this:
print(cipher.encode("Hello, does this pwn or WHAT?", "sdfgw"))
-->
ZHQRK, IUAK YNEK UCJ RW SZDY?
And the decode function to do the opposite...
print(cipher.decode("ZHQRK, IUAK YNEK UCJ RW SZDY?", "sdfgw"))
-->
hello, does this pwn or what?
=D |