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 15 and 9 minutes, respectively.
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
File details
Details for the file rehash-1.0.0.tar.gz
.
File metadata
- Download URL: rehash-1.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d8d4d4a6848dd75e638d4720e172d95927ed32a4a11e2e8767e95beef881581 |
|
MD5 | ef637c77f27c154e88bb2cf236237972 |
|
BLAKE2b-256 | 0e4dd93e8a9d6cefbba25182c2128dee87d3f940bf4ab61bc58ceefbedf8fcdd |
File details
Details for the file rehash-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: rehash-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e903ff2c4c7668adaf6cc937b44cbe6b87e7a1c76587b7e0b896714e522f4fa |
|
MD5 | 1c41d273fa8a371c9076296e6ac2d72f |
|
BLAKE2b-256 | c9e430db193232d9e9c8e123764d84f0807535677548833ca251556ad6134c24 |