Posted 19 September 2015 - 12:31 AM
I was thinking about creating an OS and was looking through the OS section when I noticed a large number of complaints on OSs not encoding their users' passwords. So I decided create an encoder (it took me around 2-3 hours to make).
Download with pastebin get 8DpMsXFf encoder
Usage: psst… forgot how to do named spoilers :0
This my first attempt at an encoder and I would imagine that there is some fault in my code; I would appreciate feedback (well any kind of feedback is nice :D/>)
Download with pastebin get 8DpMsXFf encoder
Usage: psst… forgot how to do named spoilers :0
Spoiler
encode(username,password)
-- Do whatever
local w,r=term.write,read
w("-- Registration --\n")
w("Username: "); local u=r()
w("Password: "); local p=r("*")
if (users.exists(u)) then -- pseudo-code m8 :P/>/>
error("No, we will not let you go!")
end
local f=io.open("users.txt","a"); f:write(u); f:close()
f=io.open("keys.txt","a"); f:write(encode(u,p)); f:close()
Edited on 18 September 2015 - 11:48 PM