Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- term.clear()
- if fs.exists("/disk/id") then
- content=fs.open("/disk/id", "r")
- line=content.readLine()
- limit=0
- for i=1, string.len(line) do
- if string.sub(line, i, i) == ":" then
- limit=i
- break
- end
- end
- user=string.sub(line, 1, limit-1)
- hash=tonumber(string.sub(line, limit+1, string.len(line)))
- content.close()
- print("Identified as " .. user)
- term.write("Enter your password: ")
- pass=read("*")
- hashed=1
- for i=1, string.len(pass) do
- hashed=hashed+157*string.byte(pass, i)
- if i % 2 == 0 then hashed=hashed*503
- else hashed=hashed*947
- end
- end
- if hashed == hash then
- print("Connected")
- else
- print("Wrong password")
- end
- else
- print("Enter your ID")
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement