Metadata-Version: 2.1
Name: charmonium.determ-hash
Version: 0.2.2
Summary: 
Home-page: https://github.com/charmoniumQ/charmonium.determ_hash.git
License: MIT
Keywords: deterministic,hash
Author: Samuel Grayson
Author-email: grayson5@illinois.edu
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: xxhash (>=2.0.2,<3.0.0)
Project-URL: Repository, https://github.com/charmoniumQ/charmonium.determ_hash.git
Description-Content-Type: text/x-rst

======================
charmonium.determ_hash
======================

.. image: https://img.shields.io/pypi/dm/charmonium.determ_hash
   :alt: PyPI Downloads
.. image: https://img.shields.io/pypi/l/charmonium.determ_hash
   :alt: PyPI Downloads
.. image: https://img.shields.io/pypi/pyversions/charmonium.determ_hash
   :alt: Python versions
.. image: https://img.shields.io/github/stars/charmoniumQ/charmonium.determ_hash?style=social
   :alt: GitHub stars
.. image: https://img.shields.io/librariesio/sourcerank/pypi/charmonium.determ_hash
   :alt: libraries.io sourcerank

- `PyPI`_
- `GitHub`_

.. _`PyPI`: https://pypi.org/project/charmonium.determ_hash/
.. _`GitHub`: https://github.com/charmoniumQ/charmonium.determ_hash

This library provides a deterministic hash for Python objects. |hash|_ will give
different results each process invocation, in order to thwart denial-of-service
attacks based on intentionally triggering hash collisions (see ``-R`` in
`Python's CLI options`_). Even setting ``PYTHONHASHSEED`` is not enough, because
the hash can still use non-deterministic data such as pointer-addresses. By
default, this package uses the `xxhash`_ algorithm, which is the fastest
non-cryptographic hash I know of.

>>> from charmonium.determ_hash import determ_hash
>>> determ_hash(b"hello world")
141361478936837800319111455324245712876

.. |hash| replace:: ``hash``
.. _`hash`: https://docs.python.org/3/library/functions.html?highlight=hash#hash
.. _`Python's CLI options`: https://docs.python.org/3/using/cmdline.html
.. _`xxhash`: https://cyan4973.github.io/xxHash/

