Creating an md5 object in python with an initial value

Viewed 1589

I have some code that needs to hash certain data, then later on, in another process, continue the hash with more data.

Is there a way to create an object, either from the md5 or hashlib modules, which has a different initial value than 'd41d8cd98f00b204e9800998ecf8427e'? What I mean is something similar to:

x = md5.from_digest('0123456789abcdef')
x.update(new_data)

Note: the less desirable approach would be to save the original md5 object and restore it later, but afaik HASH objects are non-pickleable.

1 Answers
Related