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