rehash


Namerehash JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/kislyuk/rehash
SummaryResumable hashlib: a picklable interface to CPython's OpenSSL-based hashlib standard library
upload_time2022-08-28 22:58:27
maintainer
docs_urlNone
authorAndrey Kislyuk
requires_python
licenseApache Software License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Rehash: Resumable Hashlib
=========================

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:

.. code-block:: python

  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.

.. admonition:: Non-openssl hashers

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

.. admonition:: PyPy

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

.. admonition:: 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
-----
* `Project home page (GitHub) <https://github.com/kislyuk/rehash>`_
* `Documentation (Read the Docs) <https://rehash.readthedocs.io/en/latest/>`_
* `Package distribution (PyPI) <https://pypi.python.org/pypi/rehash>`_
* `Change log <https://github.com/kislyuk/rehash/blob/master/Changes.rst>`_

Bugs
~~~~
Please report bugs, issues, feature requests, etc. on `GitHub <https://github.com/kislyuk/rehash/issues>`_.

License
-------
Licensed under the terms of the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_.

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kislyuk/rehash",
    "name": "rehash",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Andrey Kislyuk",
    "author_email": "kislyuk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d3/15/786002df819c59f1c1e68725db2ca9d2820d5bdb0f616ae03e6f0fe0a483/rehash-1.0.1.tar.gz",
    "platform": "MacOS X",
    "description": "Rehash: Resumable Hashlib\n=========================\n\nRehash is a resumable interface to the OpenSSL-based hashers (message digest objects) in the\nCPython ``hashlib`` standard library. Rehash provides hashers that\ncan be pickled, persisted and reconstituted from their ``repr()``,\nand otherwise serialized. The rest of the Rehash API is identical to\n``hashlib``.\n\nRehash hashers can be used to checkpoint and restore progress\nwhen hashing large byte streams:\n\n.. code-block:: python\n\n  import pickle, rehash\n  hasher = rehash.sha256(b\"foo\")\n  state = pickle.dumps(hasher)\n\n  hasher2 = pickle.loads(state)\n  hasher2.update(b\"bar\")\n\n  assert hasher2.hexdigest() == rehash.sha256(b\"foobar\").hexdigest()\n\nInstallation\n------------\n::\n\n    pip install rehash\n\nApplications\n~~~~~~~~~~~~\nRehash is useful in any situation when your VM is short-lived or preemptible, and the object you're hashing is huge. For\nexample, Rehash can be used to hand off the hashing state of large objects between AWS Lambda functions or Google Cloud\nFunctions, which have runtime limits of 15 and 9 minutes, respectively.\n\n.. admonition:: Non-openssl hashers\n\n  ``sha3`` and ``blake2`` hash algorithms in Python 3.6 are not OpenSSL-based and not supported by rehash.\n\n.. admonition:: PyPy\n\n  PyPy uses its own hasher implementations. Those are not serializable using rehash.\n\n.. admonition:: Security note\n\n  By default, rehash objects present themselves with a ``repr()`` that exposes their internal state. This allows one to\n  resume the hashing from the point where it stopped. If exposed through an untrusted channel under specific conditions,\n  this could potentially allow an attacker to use an extension attack. If you are unsure about the implications of this,\n  set ``rehash.opaque_repr = True`` after importing rehash.\n\nLinks\n-----\n* `Project home page (GitHub) <https://github.com/kislyuk/rehash>`_\n* `Documentation (Read the Docs) <https://rehash.readthedocs.io/en/latest/>`_\n* `Package distribution (PyPI) <https://pypi.python.org/pypi/rehash>`_\n* `Change log <https://github.com/kislyuk/rehash/blob/master/Changes.rst>`_\n\nBugs\n~~~~\nPlease report bugs, issues, feature requests, etc. on `GitHub <https://github.com/kislyuk/rehash/issues>`_.\n\nLicense\n-------\nLicensed under the terms of the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_.\n\n.. image:: https://github.com/kislyuk/rehash/workflows/Python%20package/badge.svg\n        :target: https://github.com/kislyuk/rehash/actions\n.. image:: https://codecov.io/github/kislyuk/rehash/coverage.svg?branch=master\n        :target: https://codecov.io/github/kislyuk/rehash?branch=master\n.. image:: https://img.shields.io/pypi/v/rehash.svg\n        :target: https://pypi.python.org/pypi/rehash\n.. image:: https://img.shields.io/pypi/l/rehash.svg\n        :target: https://pypi.python.org/pypi/rehash\n.. image:: https://readthedocs.org/projects/rehash/badge/?version=latest\n        :target: https://rehash.readthedocs.org/\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "Resumable hashlib: a picklable interface to CPython's OpenSSL-based hashlib standard library",
    "version": "1.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d4365b4342592ea769785275c7aa1dc7",
                "sha256": "bbce1e17887dad67317d3e59cb091be8e130f1a9e35e3f0129d5df1b5896a869"
            },
            "downloads": -1,
            "filename": "rehash-1.0.1-py2.py3-none-any.whl",
            "has_sig": true,
            "md5_digest": "d4365b4342592ea769785275c7aa1dc7",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9010,
            "upload_time": "2022-08-28T22:58:26",
            "upload_time_iso_8601": "2022-08-28T22:58:26.341181Z",
            "url": "https://files.pythonhosted.org/packages/63/98/51a7b433437794184fb7846960c1af275a1efa01baa481f49ed58bc2f20a/rehash-1.0.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "071e0ba62332af8ba875a9aad813ab58",
                "sha256": "17abf2400fe1361c036fea2f7963c852ec5b6d52d4718ff345e0fa9914e861e2"
            },
            "downloads": -1,
            "filename": "rehash-1.0.1.tar.gz",
            "has_sig": true,
            "md5_digest": "071e0ba62332af8ba875a9aad813ab58",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9279,
            "upload_time": "2022-08-28T22:58:27",
            "upload_time_iso_8601": "2022-08-28T22:58:27.842295Z",
            "url": "https://files.pythonhosted.org/packages/d3/15/786002df819c59f1c1e68725db2ca9d2820d5bdb0f616ae03e6f0fe0a483/rehash-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-28 22:58:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kislyuk",
    "github_project": "rehash",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rehash"
}
        
Elapsed time: 0.02747s