Advertisement
Adm1n_0v3rride

Hashlib in python 2.7.10

Dec 20th, 2017
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. #  .__                  .__    .__  ._____.    
  2. #  |  |__ _____    _____|  |__ |  | |__\_ |__  
  3. #  |  |  \\__  \  /  ___/  |  \|  | |  || __ \
  4. #  |   Y  \/ __ \_\___ \|   Y  \  |_|  || \_\ \
  5. #  |___|  (____  /____  >___|  /____/__||___  /
  6. #       \/     \/     \/     \/             \/
  7. #
  8. #       This is an example program to demonstrate the use of the hashlib library (C) 2017 Adm1n_0verride
  9. #
  10. import hashlib
  11.  
  12. # In md5
  13. am = hashlib.md5()
  14. am.update('Greetings and merry christmas!')
  15. print am.hexdigest()
  16. # prints '2d13f4f787c5dcff600d2a2ca1862e58'
  17.  
  18. # In SHA1
  19. a = hashlib.sha1()
  20. a.update('Example of sha1')
  21. print am.hexdigest()
  22. # prints 'd8133a2b795859d876425eb4e2331455'
  23.  
  24. # In SHA224
  25. b = hashlib.sha224()
  26. b.update('The quick brown fox jumped over the lazy brown dog')
  27. print b.hexdigest()
  28. # prints '5f1cfd0e3d26dbc80f366eaed578aa71b0fe998d9775e45bf513d634'
  29.  
  30. # In SHA256
  31. c = hashlib.sha256()
  32. c.update('Hello friend')
  33. print c.hexdigest()
  34. # prints 'ad7c4d7f20d11015260cd4609df255c99ebef944f59110167f2ff62a2c750072'
  35.  
  36. # In SHA384
  37. d = hashlib.sha384()
  38. d.update('Whatever you get the picture.')
  39. print d.hexdigest()
  40. # prints '3175d35e42671528c971a0611bbe1556f27db5311940a6f62ba07ff03a84f90d200b5ac97146dacb5c58a995ba11bd5a
  41.  
  42. # In SHA512
  43. asd = hashlib.sha512()
  44. asd.update('The day is tommrow')
  45. print asd.hexdigest()
  46. # prints 'caf1272b9a58c557001e2a1aafffc4215e3c3693352af3db9c2786d25dfe24d55d4b72e3f8dd03791fd6e0fabe0023c629dfbacb05584db553d7162acb40d1fa'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement