Resumable hashlib: a picklable interface to CPython's OpenSSL-based hashlib standard library
Project description
Rehash is a resumable interface to the OpenSSL-based hashers (message digest objects) in the CPython hashlib standard library. Rehash provides hashers that can be pickled, persisted and reconstituted from their repr(), and otherwise serialized. The rest of the Rehash API is identical to hashlib.
Rehash hashers can be used to checkpoint and restore progress when hashing large byte streams:
import pickle, rehash
hasher = rehash.sha256(b"foo")
state = pickle.dumps(hasher)
hasher2 = pickle.loads(state)
hasher2.update(b"bar")
assert hasher2.hexdigest() == rehash.sha256(b"foobar").hexdigest()
Installation
pip install rehash
Applications
Rehash is useful in any situation when your VM is short-lived or preemptable, and the object you’re hashing is huge. For example, Rehash can be used to hand off the hashing state of large objects between AWS Lambda functions or Google Cloud Functions, which have runtime limits of 5 and 9 minutes, respectively (TODO: example).
Links
Bugs
Please report bugs, issues, feature requests, etc. on GitHub.
License
Licensed under the terms of the Apache License, Version 2.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rehash-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3970d485e16665c139e7d95dde42ddf7603ac389ca6cec6efce208924ea515a |
|
MD5 | 0cd674538c55a718181cc60eed8f5758 |
|
BLAKE2b-256 | 268e6d7032014db4acf457517ed944d0a83eac59e27bd785b28155e5ec1246a7 |