Advertisement
Guest User

HASHPASTE

a guest
Feb 1st, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. __author__ = 'Jacco'
  2.  
  3. import easygui
  4. import re
  5. import hashlib
  6.  
  7.  
  8.  
  9. def user():
  10. loop = "aan"
  11. gebruikersNaam = ""
  12. while loop == "aan":
  13. gebruikersNaam = easygui.enterbox("Voer een gebruikersnaam in:")
  14. if re.search(r"[a-z]", gebruikersNaam) and len(gebruikersNaam) > 3:
  15. loop = "uit"
  16. print gebruikersNaam
  17. else:
  18. print "Error! Gebruikersnaam is fout! probeer opnieuw"
  19. return gebruikersNaam
  20.  
  21. def password():
  22. loop = "aan"
  23. password = ""
  24. while loop == "aan":
  25. password = easygui.enterbox("Voer een password in")
  26. if len(password) >= 8 and len(password) <= 12 and re.search(r"\d",password):
  27. loop = "uit"
  28. print password
  29. else:
  30. print "Error! password is fout! probeer opnieuw"
  31. return password
  32.  
  33. def hash(password):
  34. return hashlib.sha256(password).hexdigest()
  35.  
  36.  
  37.  
  38.  
  39. lst = {}
  40. aantalGebruikers = 0
  41.  
  42. while aantalGebruikers < 3:
  43. username = user()
  44. password1 = password()
  45. passwordHash = hash(password1)
  46. lst[username] = {"password":password1,"passwordHash":passwordHash}
  47. aantalGebruikers = aantalGebruikers+1
  48.  
  49. if aantalGebruikers == 3:
  50. print "Alle gebruikers zijn toegevoegd"
  51. print lst
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement