iteration
This commit is contained in:
parent
c8868c6732
commit
8d2d7e2455
@ -35,12 +35,17 @@ function convert_password(password)
|
||||
return hash(password .. "3m&LmNm7")
|
||||
end
|
||||
|
||||
-- Does a simple hash of a string
|
||||
-- Does a complex hash of a string to make it harder to guess
|
||||
function hash(str)
|
||||
local hash = 0
|
||||
for i = 1, #str do
|
||||
hash = hash + string.byte(str, i)
|
||||
local len = string.len(str)
|
||||
local byte = 0
|
||||
|
||||
for i = 1, len do
|
||||
byte = string.byte(str, i)
|
||||
hash = bit32.band(hash * 31 + byte, 0xFFFFFFFF)
|
||||
end
|
||||
|
||||
return hash
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user