Advertisement
Guest User

Untitled

a guest
Apr 15th, 2015
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. local sha2 = require("sha2")
  2. local term = require("term")
  3.  
  4. function setPass()
  5. print("Please set password")
  6. term.write("Password: ")
  7. pass = term.read(nil, nil, nil, "*") -- password in plain text
  8. permPass = sha2.hash256(pass) --sets permPass to the hashed thingy of pass
  9. pass = nil --Make sure the pass is not left in a variable
  10. print("Done!")
  11. end
  12.  
  13. function checkPass()
  14. print("Please enter password")
  15. term.write("Password: ")
  16. pass = term.read(nil, nil, nil, "*") --password in plain text
  17. pass = sha2.hash256(pass) --Do the thingy with pass
  18. if pass == permPass then --See if pass is permPass
  19. print("Sucess")
  20. else
  21. print("Nope")
  22. end
  23. end
  24.  
  25. print("Starting setPass")
  26. setPass()
  27.  
  28. print("Starting checkPass")
  29. checkPass()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement