iteration

This commit is contained in:
Layla 2023-10-08 00:39:56 -04:00
parent 975a70f69f
commit ea5b2af9e8

View File

@ -25,14 +25,23 @@ function load_data()
end
function generate_token(user)
local token = textutils.sha256(user .. os.time() .. math.random())
local token = hash(user .. os.time() .. math.random())
data.users[user].token = token
return token
end
function convert_password(password)
return textutils.sha256(password .. "3m&LmNm7")
return hash(password .. "3m&LmNm7")
end
-- Does a simple hash of a string
function hash(str)
local hash = 0
for i = 1, #str do
hash = hash + string.byte(str, i)
end
return hash
end
load_data()