Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("sha")
- write("username :: ")
- local u = read()
- write("password :: ")
- local p = read()
- --Again, change passPath here
- local passPath = "passwords"
- local f = fs.open(passPath,"r")
- local usrs = textutils.unserialize(f.readAll())
- f.close()
- if not usrs[u] then
- local salt = os.time()
- usrs[u] = {
- pwd = sha.sha256( p .. salt ),
- salt = salt,
- }
- local f = fs.open(passPath, "w")
- f.write( textutils.serialize( usrs ) )
- f.close()
- end
Add Comment
Please, Sign In to add comment