[issue16179] hashlib.md5 / json inconsistency

2012-10-10 Thread Robin Åsén
Robin Åsén added the comment: Yes, you are quite right. Somewhere in the back of my head I had a feeling I should understand what was happening, hence my comment "Am I doing something wrong here?". I just couldn't see it. Thank you. -- ___ Python t

[issue16179] hashlib.md5 / json inconsistency

2012-10-10 Thread Hynek Schlawack
Hynek Schlawack added the comment: Actually, that’s not the point here, the code has a deeper flaw. You’re computing hashlib.md5() on `data.encode()` and `str(jsonData).encode()`. Did you have a look how they look like? >>> data.encode() b'{"key1":"value1","key2":"value2"}' [71875 refs] >>> st

[issue16179] hashlib.md5 / json inconsistency

2012-10-09 Thread R. David Murray
R. David Murray added the comment: The order in which elements are produced when iterating a dictionary is not fixed. In python3.3 it is intentionally perturbed by a randomized seed at interpreter startup by default. -- nosy: +r.david.murray resolution: -> invalid stage: -> committe

[issue16179] hashlib.md5 / json inconsistency

2012-10-09 Thread Robin Åsén
New submission from Robin Åsén: I am getting inconsistent behavior when getting an md5 hexdigest on a json structure that's converted to a string. Am I doing something wrong here? import json import hashlib data = '''{"key1":"value1","key2":"value2"}''' print(hashlib.md5(data.