I have a dictionary in python that contains unicode values in it. I want to calculate the md5 sum of this dictionary. I tried to use the answer to this question:Computing an md5 hash of a data structure
import hashlib
import bencode
data = {'unicode_text': 'سلام'}
data_md5 = hashlib.md5(bencode.bencode(data)).hexdigest()
print data_md5
But the problem is that bencode
returns this error:
KeyError: <type 'unicode'>