Posted 05 March 2014 - 09:10 PM
I had tried to make a new encryption algorithim for computercraft. It looked like it would work for me.
And then, it returns:
Code:
And then, it returns:
11
Code:
local function encrypt(str)
local t = string.reverse(str)
local ln = string.len(t)
local lh = ln/2
local lho = lh+1
local aa = string.sub(1, lh)
local ab = string.sub(lho, ln)
local encrypted = ab..""..aa
return encrypted
end
local function decrypt(str)
local t = string.reverse(str)
local ln = string.len(t)
local lh = ln/2
local lho = lh+1
local aa = string.sub(1, lh)
local ab = string.sub(lho, ln)
local decrypted = aa..""..ab
return decrypted
end
local en = encrypt("Hello World")
local de = decrypt(en)
print(en)
print(de)