Advertisement
maxtorcd55

passdoor

Mar 25th, 2013
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function pasrep(paas)
  2. local sec = 0
  3.  
  4. for i = 1,string.len(paas)-1 do
  5. sec = sec + string.byte(paas, i)
  6. end
  7.  
  8. sec = sec*string.byte (paas, string.len(paas))
  9.  
  10. return sec
  11. end
  12.  
  13. rs.setOutput("left",true)
  14.  
  15. sleep(1)
  16. local opentime = 10
  17. local side = "left"
  18. local password = 45576
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. write("Password: ")
  22. local input = read("*")
  23. if pasrep(input) == password then
  24. term.clear()
  25. term.setCursorPos(1,1)
  26. print("ok")
  27. rs.setOutput(side,false)
  28. sleep(opentime)
  29. rs.setOutput(side,true)
  30. os.reboot()
  31. else
  32. print(pasrep(input))
  33. print(password)
  34. term.clear()
  35. term.setCursorPos(1,1)
  36. print("Password incorrect!")
  37. sleep(2)
  38. os.reboot()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement