Advertisement
Guest User

flynktry

a guest
Feb 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/bin/python3
  2. import hashlib
  3.  
  4.  
  5. def makehash(_dict):
  6.  
  7. _string = str(_dict)
  8. _encode = _string.encode('UTF-8')
  9. _hash = hashlib.md5()
  10. _hash.update(_encode)
  11. return _hash.hexdigest()
  12.  
  13.  
  14.  
  15. def main():
  16.  
  17. _dict1 = {'a':1, 'b':2, 'c':3}
  18. _dict2 = {'a': 1, 'b': 2, 'c': 3}
  19.  
  20. hash1 = makehash(_dict1)
  21. hash2 = makehash(_dict2)
  22.  
  23. if hash1 == hash2:
  24. print ('gleich')
  25.  
  26. print('Ende')
  27.  
  28. if __name__ == '__main__':
  29. main()
  30. #TODO b'\xb1\n\x8d\xb1d\xe0uA\x05\xb7\xa9\x9b\xe7.?\xe5'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement