Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I undo this hashing function?

Asked by 5 years ago

Here is the code I use to hash a string before its sent:

local letters = 'QYh29ktXxJ8noBg HNq5)z;MT6K7EIFRcjO0P:aUb(epZifSGWD,1sv&ALrmd3Vwu.lyC4'

local tbl = {'UserName','PassWord',tick()}

local len = 52

function GetLetterWithOffset(str,offset)

offset = ((((offset/1337)/6)*8)/4)/7

--print(offset)

local NewStr = ''

local ghetto = letters:rep(math.floor(offset/len)+1)

for i=1,str:len() do

local letter = str:sub(i,i)

local a;

for i=1,string.len(letters) do

if string.sub(letters,i,i) == tostring(letter) then

a = i

break

end

end

local letteroffset = a*(math.floor(offset/len)+1);

NewStr = NewStr..ghetto:sub(letteroffset,letteroffset)

end

--print(NewStr)

return NewStr

end

a = {}

print'=========='

function a:Hash(str)

math.randomseed(tick()+math.random(1,9*math.random(1,99999)))

local offset = math.random(100000,999999)

math.randomseed(offset)

local offset = math.random(10000,99999)

--print(offset)

offset = ((((offset * 7) 4 )/8)6)*1337

--print(offset)

return GetLetterWithOffset(str..tostring(tick()),offset),offset

end

function FlatLayer(hash)

--local tik = tick()

hash = hash--..tik

local newhash = GetLetterWithOffset(hash,6217326)

return newhash,6217326

end

function RemoveHash(hash)

local offset = 6217326

offset = ((((offset/1337)/6)*8)/4)/7

end

local b,c = FlatLayer(a:Hash('Hey dood lmao'))

print('Hash: '..b)

print('Offset: '..c)

My only problem is im kind of slow so I cant figure out how to de-hash it w/ the static layer.. :( If anyone could help me out, it'd be much appriciated :)

(String manipulation/ math:thonk:)

0
Are you seriously trying to obfuscate. Don't do it. User#24403 69 — 5y
0
whys that? SoulessKnowledge 2 — 5y
0
im just trying to protect data sent between client and https /shrug SoulessKnowledge 2 — 5y

Answer this question