classification
Title: Serialize MD5 computation-state and resume later
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: Ye.Yuan, christian.heimes, gregory.p.smith, r.david.murray
Priority: normal Keywords:

Created on 2012-09-27 04:37 by Ye.Yuan, last changed 2012-10-07 02:50 by gregory.p.smith. This issue is now closed.

Messages (4)
msg171367 - (view) Author: Ye Yuan (Ye.Yuan) Date: 2012-09-27 04:37
Serialize/deserialize md5 context. Pseudocode:

import md5
# Start hash generation
m = md5.new()
m.update("Content")

# Serialize m
serialized_m = serialize(m)

# In another function/machine, deserialize m
# and continue hash generation
m2 = deserialize(serialized_m)
m2.update("More content")
m2.digest() 

There are C++ lib but no Python one.
msg171374 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-09-27 13:37
In the python context I believe what you are asking for is to make hashlib hash objects pickleable.
msg172267 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2012-10-06 23:57
I don't think it's possible to serialize an crypto hash object like MD5. The internal states of those objects are opaque data structures. There is no way official way to access the data structures in a platform independent way.

It *might* be possible to hack something for our own implementation of md5 but definitely not for OpenSSL's implementation.
msg172279 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2012-10-07 02:50
Unless someone supplies a patch that works inter-operably across all platforms using public APIs in openssl and with the internals of all of python's builtin non-openssl hash functions including unitests for all of the above... This isn't going to be implemented in the stdlib.
History
Date User Action Args
2012-10-07 02:50:37gregory.p.smithsetstatus: open -> closed
assignee: gregory.p.smith
resolution: rejected
messages: + msg172279
2012-10-06 23:57:53christian.heimessetnosy: + gregory.p.smith, christian.heimes
messages: + msg172267
2012-09-27 13:37:55r.david.murraysetnosy: + r.david.murray

messages: + msg171374
versions: + Python 3.4, - Python 2.7
2012-09-27 04:37:06Ye.Yuancreate