Posted 19 December 2015 - 03:13 PM
EDIT: I did some stuff and the issue solved itself. I still don't know why this happened but its fixed
So, while doing some stuff, i decided to add an user system to my computer. Now, creating users aren't a problem, but i have a weird error in the authenicator.
So, because i wanted to be secure, i used Sha1 and salting. But some reason, the authenicator only works on ONE salt.
It does not pop up an error message, just says the password is wrong.
User creation code:
User authenication code:
and here is the only working salt file:
Filename: .salty-eEu9X
Content: aca2c0f788fa6e92c0c26d05457e92cfa663908f
(It's the Sha1+salt of 123456, btw)
I think i can give some other info if needed.
So, while doing some stuff, i decided to add an user system to my computer. Now, creating users aren't a problem, but i have a weird error in the authenicator.
So, because i wanted to be secure, i used Sha1 and salting. But some reason, the authenicator only works on ONE salt.
It does not pop up an error message, just says the password is wrong.
User creation code:
function makeUser(name, password)
local salt = libRand.randomString(5)
fs.makeDir("home/" .. name)
salty = fs.open("home/" .. name .. "/.salty-" .. salt, "w")
salty.write(Sha1.Sha1(password .. salt))
salty.close();
for k, v in pairs(fs.list("/etc/skel/home")) do
fs.copy("/etc/skel/home/" .. v, "/home/" .. name .. "/" .. v)
end
end
User authenication code:
function authUser(name, password)
for i, v in pairs(fs.list("home/" .. name)) do
if (stringStuff.starts(v, ".salty-")) then
q = stringStuff.split(v,"-")
enteredPass = Sha1.Sha1(password .. q[2])
salty = fs.open("home/" .. name .. "/.salty-" .. q[2], "r")
savedPass = salty.readAll()
salty.close();
if enteredPass == savedPass then
_G.usr["current"] = name
return true
else
return false
end
end
end
end
and here is the only working salt file:
Filename: .salty-eEu9X
Content: aca2c0f788fa6e92c0c26d05457e92cfa663908f
(It's the Sha1+salt of 123456, btw)
I think i can give some other info if needed.
Edited on 19 December 2015 - 04:59 PM