PDA

View Full Version : [Script] [Lua] String Encrypt-er / Unencrypt-er


Ho-oh 112
March 20th, 2012, 06:52 AM
I made a random lua script for everyone, it allows you to compile a string using:
encryptString(string,NumberToEncryptBy)
also it comes with a unencrypter:
unencryptString(string,NumberToEncryptBy)
so basicly it's not usable for RMXP...

script:


function encryptString(str,code)
-- character table
chars="1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,<.>/?;:'[{]}\|`~"
-- new code begin
newcode=""
-- we start
for i=1, 999 do
if string.sub(str,i,i) == "" then
break
else
com=string.sub(str,i,i)
end
for x=1, 90 do
cur=string.sub(chars,x,x)
if com == cur then
new=x+code
while new > 90 do
new = new - 90
end
newcode=""..newcode..""..string.sub(chars,new,new)..""
end
end
end
print("you new code is: "..newcode.."")
return newcode
end

function unencryptString(str,code)
-- character table
chars="1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,<.>/?;:'[{]}\|`~"
-- new code begin
newcode=""
-- we start
for i=1, 999 do
if string.sub(str,i,i) == "" then
break
else
com=string.sub(str,i,i)
end
for x=1, 90 do
cur=string.sub(chars,x,x)
if com == cur then
new=x-code
while new < 0 do
new = new + 90
end
newcode=""..newcode..""..string.sub(chars,new,new)..""
end
end
end
print("you old string is: "..newcode.."")
return newcode
end