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 preemptible, 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.
Security note
By default, rehash objects present themselves with a repr() that exposes their internal state. This allows one to
resume the hashing from the point where it stopped. If exposed through an untrusted channel under specific conditions,
this could potentially allow an attacker to use an extension attack. If you are unsure about the implications of this,
set rehash.opaque_repr = True after importing rehash.
Links
Bugs
Please report bugs, issues, feature requests, etc. on GitHub .
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.1.tar.gz
.
File metadata
Download URL:
rehash-1.0.1.tar.gz
Upload date: Aug 28, 2022
Size: 9.3 kB
Tags: Source
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.13
File hashes
Hashes for rehash-1.0.1.tar.gz
Algorithm
Hash digest
SHA256
17abf2400fe1361c036fea2f7963c852ec5b6d52d4718ff345e0fa9914e861e2
Copy
MD5
071e0ba62332af8ba875a9aad813ab58
Copy
BLAKE2b-256
d315786002df819c59f1c1e68725db2ca9d2820d5bdb0f616ae03e6f0fe0a483
Copy
See more details on using hashes here.
File details
Details for the file rehash-1.0.1-py2.py3-none-any.whl
.
File metadata
Download URL:
rehash-1.0.1-py2.py3-none-any.whl
Upload date: Aug 28, 2022
Size: 9.0 kB
Tags: Python 2, Python 3
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.13
File hashes
Hashes for rehash-1.0.1-py2.py3-none-any.whl
Algorithm
Hash digest
SHA256
bbce1e17887dad67317d3e59cb091be8e130f1a9e35e3f0129d5df1b5896a869
Copy
MD5
d4365b4342592ea769785275c7aa1dc7
Copy
BLAKE2b-256
639851a7b433437794184fb7846960c1af275a1efa01baa481f49ed58bc2f20a
Copy
See more details on using hashes here.