Skip to content
/ rehash Public

Resumable hashlib: a picklable interface to CPython's OpenSSL-based hashlib standard library

License

Notifications You must be signed in to change notification settings

kislyuk/rehash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rehash: Resumable Hashlib

Rehash is a resumable interface to the OpenSSL-based hashers in the CPython hashlib standard library. Rehash provides hashers that can be pickled, 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()

Non-openssl hashers

sha3 and blake2 hash algorithms in Python 3.6 are not OpenSSL-based and not supported by rehash.

PyPy

PyPy uses its own hasher implementations. Those are not serializable using rehash.

Links

Bugs

Please report bugs, issues, feature requests, etc. on GitHub.

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://readthedocs.org/projects/rehash/badge/?version=latest

About

Resumable hashlib: a picklable interface to CPython's OpenSSL-based hashlib standard library

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published