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

License

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

https://travis-ci.org/kislyuk/rehash.png 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-0.3.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

rehash-0.3.1-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: rehash-0.3.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rehash-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7bf08120d88151457bd6cb0b4ab9b03f0f0124814db9b42d09823f76ae6a4a8d
MD5 81591606a61b9c85e2d8dce995e74c44
BLAKE2b-256 3245ad549ff460677e0ddb6dbbc9615310cc2980d5dffd2c39d3f25e8dddb1e3

See more details on using hashes here.

File details

Details for the file rehash-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rehash-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 daa8f7bdd61dcff2a36be56154431e4a47d5a942f385a822392b045334836c0f
MD5 8c1d773318c5812818a13f19e59a1460
BLAKE2b-256 e5fe6a2b7ba5168a5b38e6188845428279c8a2dcfff6d1e90aeefa81915e8d7e

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