[Release] String Hasher
Posted 05-21-2019 - 08:58 PM by IcyJake
#1
This is my custom-made string hasher. I probably don't even need to explain what this script does because it's literally in the name. Anyways, here you go:

Code:
local chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890+/"

function hash(s)
    local len = #chars + 1
    local cur = #s % len
    local toReturn = ""
    local toReturn2 = ""
    
    for letter = 1, #s do
        cur = (cur + s:sub(letter, letter):byte()) % len
        toReturn = toReturn .. chars:sub(cur, cur)
    end
    
    local seed = 0
    
    for i, v, r in toReturn:gmatch("(.)(.)(.)") do
        seed = seed + (i:byte() / v:byte()) * r:byte()
    end
    
    if #s < 3 then
        seed = 24e12
        
        for i = 1, #s do
            seed = seed / s:sub(i, i):byte()
        end
    end
    
    local to = ""
    
    math.randomseed(seed)
    
    for i = 1, 32 do
        local c = math.random(len)
        to = to .. chars:sub(c, c)
    end
    
    return to
end

messageToEncrypt = hash("IcyJake is cool") -- Put the string you want to hash here

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print(messageToEncrypt)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

[Image: F8bsrU6.png]

1 Guest(s)