Advertisement
aixtools

Password-Hasher-Puzzle

Aug 15th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. This is a value I take from the pidev-server log:
  2.  
  3. from argon2 import PasswordHasher
  4. ph = PasswordHasher()
  5.  
  6. print("Test as string")
  7. hash='$argon2i$v=19$m=102400,t=2,p=8$NSYEwHiP0VoLQQgBAKD0Pg$Tg493ikpeaglkoFmG5AdYw'
  8. print("check: %s of type:%s" % (ph.check_needs_rehash(hash), type(hash)))
  9.  
  10. print("Test as bytes")
  11. hash=b'$argon2i$v=19$m=102400,t=2,p=8$NSYEwHiP0VoLQQgBAKD0Pg$Tg493ikpeaglkoFmG5AdYw'
  12. print("check: %s of type:%s" % (ph.check_needs_rehash(hash), type(hash)))
  13.  
  14. Result:
  15. Test as string
  16. check: True of type:<class 'str'>
  17. Test as bytes
  18. Traceback (most recent call last):
  19. File "arg1-test.py", line 11, in <module>
  20. print("check: %s of type:%s" % (ph.check_needs_rehash(hash), type(hash)))
  21. File "/home/devpi/piserv/lib/python3.7/site-packages/argon2/_password_hasher.py", line 212, in check_needs_rehash
  22. return self._parameters != extract_parameters(hash)
  23. File "/home/devpi/piserv/lib/python3.7/site-packages/argon2/_utils.py", line 163, in extract_parameters
  24. parts = hash.split("$")
  25. TypeError: a bytes-like object is required, not 'str'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement