import hashlib
import json
a = {'name': 'Danish', 'age': 107}
b = {'age': 107, 'name': 'Danish'}
print(hashlib.sha1(json.dumps(a, sort_keys=True)).hexdigest())
print(hashlib.sha1(json.dumps(b, sort_keys=True)).hexdigest())
How To Create a Unique Key For A Dictionary In Python