diff --git a/auth_server.lua b/auth_server.lua index 219a568..229147f 100644 --- a/auth_server.lua +++ b/auth_server.lua @@ -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()