Skip to main content

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 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.

License

Licensed under the terms of the Apache License, Version 2.0.

https://github.com/kislyuk/rehash/workflows/Python%20package/badge.svg https://codecov.io/github/kislyuk/rehash/coverage.svg?branch=master https://img.shields.io/pypi/v/rehash.svg https://img.shields.io/pypi/l/rehash.svg https://readthedocs.org/projects/rehash/badge/?version=latest

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

rehash-1.0.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

rehash-1.0.1-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rehash-1.0.1.tar.gz.

File metadata

  • Download URL: rehash-1.0.1.tar.gz
  • Upload date:
  • 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
MD5 071e0ba62332af8ba875a9aad813ab58
BLAKE2b-256 d315786002df819c59f1c1e68725db2ca9d2820d5bdb0f616ae03e6f0fe0a483

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:
  • 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
MD5 d4365b4342592ea769785275c7aa1dc7
BLAKE2b-256 639851a7b433437794184fb7846960c1af275a1efa01baa481f49ed58bc2f20a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page