Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Written by valithor
- http://www.computercraft.info/forums2/index.php?/topic/24527-small-hashingencryption-api/page__hl__encrypt__fromsearch__1
- ]]--
- function hash(msg,salt,bool)
- if not bool then
- for i = 1, 10 do
- msg = hash(msg,salt or "",true)
- end
- end
- local num = ""
- local salt = salt ~= nil and salt..msg or msg
- for i = 1, #salt do
- local let = salt:sub(i,i):byte()
- num = let <= 9 and num.."99"..let or let<=99 and num.."9"..let or num..let
- end
- math.randomseed(tonumber(num))
- local hashed = ""
- for i = 1, 32 do
- hashed = hashed..string.char(math.random(32,127))
- end
- return hashed
- end
Advertisement
Add Comment
Please, Sign In to add comment