import hashlib
import json
names = ["Tom", "John", "Tom"]
def json_md5(name):
json_str = json.dumps({"name": name})
hash1 = hashlib.md5()
hash1.update(json_str.encode('utf-8'))
return hash1.hexdigest()
names_md5key = [json_md5(name) for name in names]
assert len(names_md5key[0]) == 32
assert names_md5key[0] == names_md5key[2]
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)