Yey*_*Yey 10 python security hash md5
我想序列化/反序列化md5上下文.但我不知道如何在Python中做到这一点.我想做的伪代码.
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()
Run Code Online (Sandbox Code Playgroud)
这有C++库.是否有一个Python?为什么md5库不支持它?有安全问题吗?谢谢.
编辑:我想这样做是因为例如,HTTP服务器想要接受不同HTTP请求中的流数据.在请求之间以某种方式序列化md5上下文会很方便.
我问吉多·V·罗森先生。他回答说:“我认为没有办法。不过,它可能会提出一个不错的功能请求。你可以向 bugs.python.org 提交一个。” 所以我做了。
http://bugs.python.org/issue16059