I want to compute an md5 hash not of a string, but of an entire data structure. I understand the mechanics of a way to do this (dispatch on the type of the value, canonical
UPDATE: this won't work for dictionaries due to key order randomness. Sorry, I've not thought of it.
import hashlib
import cPickle as pickle
data = ['anything', 'you', 'want']
data_pickle = pickle.dumps(data)
data_md5 = hashlib.md5(data_pickle).hexdigest()
This should work for any python data structure, and for objects as well.