可序列化哈希对象
hashstate的Python项目详细描述
哈希状态
这是一个python c扩展模块,它派生hashlib
实现
从cpython本身添加对单个特性的支持:能够
序列化和反序列化哈希对象,以便哈希对象不具有
在哈希计算的整个过程中保持在内存中。
用法
pip install hashstate
importhashstate# Contains all the same constructors as hashlibhash1=hashstate.sha512()hash1.update('...')s=hash1.serialize()# gives back bytes objecthash2=hashstate.sha512()hash2.deserialize(s)asserthash1.digest()==hash2.digest()
开发人员
生成包(在生成路径上需要openssl):
python setup.py sdist bdist_wheel
如果要构建MacOS控制盘,请运行:
delocate-wheel -v ./dist/*-macosx_*.whl
构建Linux bdist_控制盘(目前仅64位):
docker build -t manylinux-hashstate .
docker run --rm -v $(pwd)/dist:/dist manylinux-hashstate
上载到PYPI
twine upload dist/*