Metadata-Version: 1.1
Name: xxhash
Version: 0.3.0
Summary: Python binding for xxHash
Home-page: https://github.com/ifduyue/python-xxhash
Author: Yue Du
Author-email: ifduyue@gmail.com
License: UNKNOWN
Description: python-xxhash
        =============
        
        .. image:: https://travis-ci.org/ifduyue/python-xxhash.svg?branch=master
            :target: https://travis-ci.org/ifduyue/python-xxhash
            :alt: Build Status
        
        .. image:: https://pypip.in/version/xxhash/badge.svg
            :target: https://warehouse.python.org/project/xxhash/
            :alt: Latest Version
        
        .. image:: https://pypip.in/download/xxhash/badge.svg
            :target: https://warehouse.python.org/project/xxhash/
            :alt: Downloads
        
        .. image:: https://pypip.in/py_versions/xxhash/badge.svg
            :target: https://warehouse.python.org/project/xxhash/
            :alt: Supported Python versions
        
        .. image:: https://pypip.in/license/xxhash/badge.svg
            :target: https://warehouse.python.org/project/xxhash/
            :alt: License
        
        
        .. _HMAC: http://en.wikipedia.org/wiki/Hash-based_message_authentication_code
        .. _xxHash: https://code.google.com/p/xxhash/
        .. _Cyan4973: https://github.com/Cyan4973
        
        
        xxhash is a Python binding for the xxHash_ library by `Yann Collet`__.
        
        __ Cyan4973_
        
        Installation
        ------------
        ::
        
            $ pip install xxhash
        
        Usage
        --------
        
        Module version and its backend xxHash library version can be retrieved using
        the module properties ``VERSION`` AND ``XXHASH_VERSION`` respectively.
        
        .. code-block:: python
        
            >>> import xxhash
            >>> xxhash.VERSION
            '0.3.0'
            >>> xxhash.XXHASH_VERSION
            'r37'
        
        This module is hashlib-compliant, which means you can use it in the same way as ``hashlib.md5``.
        
            | update() -- updates the current digest with an additional string
            | digest() -- return the current digest value
            | hexdigest() -- return the current digest as a string of hexadecimal digits
            | intdigest() -- return the current digest as an integer
            | copy() -- return a copy of the current xxhash object
        
        md5 digest returns bytes, but the original xxh32 and xxh64 C APIs return integers.
        While this module is made hashlib-compliant, ``intdigest()`` is also provided to
        get the integer digest.
        
        Constructors for hash algorithms provided by this module are ``xxh32()`` and ``xxh64()``.
        
        For example, to obtain the digest of the byte string ``b'Nobody inspects the spammish repetition'``.
        
        .. code-block:: python
        
            >>> import xxhash
            >>> x = xxhash.xxh32()
            >>> x.update(b'Nobody inspects')
            >>> x.update(b' the spammish repetition')
            >>> x.digest()
            b'\xe2);/'
            >>> x.digest_size
            4
            >>> x.block_size
            16
        
        More condensed.
        
        .. code-block:: python
        
            >>> xxhash.xxh32(b'Nobody inspects the spammish repetition').hexdigest()
            'e2293b2f'
            >>> xxhash.xxh32(b'Nobody inspects the spammish repetition').digest() == x.digest()
            True
        
        An optional seed (default is 0) can be used to alter the result predictably.
        
        .. code-block:: python
        
            >>> import xxhash
            >>> xxhash.xxh64('xxhash').hexdigest()
            '32dd38952c4bc720'
            >>> xxhash.xxh64('xxhash', seed=20141025).hexdigest()
            'b559b98d844e0635'
            >>> x = xxhash.xxh64(seed=20141025)
            >>> x.update('xxhash')
            >>> x.hexdigest()
            'b559b98d844e0635'
            >>> x.intdigest()
            13067679811253438005
        
        ``digest()`` returns bytes of the big-endian** representation of the integer
        digest.
        
        .. code-block:: python
        
            >>> import xxhash
            >>> h = xxhash.xxh64()
            >>> h.digest()
            b'\xefF\xdb7Q\xd8\xe9\x99'
            >>> h.intdigest().to_bytes(8, 'big')
            b'\xefF\xdb7Q\xd8\xe9\x99'
            >>> h.hexdigest()
            'ef46db3751d8e999'
            >>> format(h.intdigest(), '016x')
            'ef46db3751d8e999'
            >>> h.intdigest()
            17241709254077376921
            >>> int(h.hexdigest(), 16)
            17241709254077376921
        
        
        Caveats
        -------
        
        ENDIANNESS
        ~~~~~~~~~~~
        
        As of python-xxhash 0.3.0, ``digest()`` returns bytes of the
        **big-endian** representation of the integer digest. It used
        to be little-endian.
        
        DONT USE XXHASH IN HMAC
        ~~~~~~~~~~~~~~~~~~~~~~~
        Though you can use xxhash as an HMAC_ hash function, but it's
        highly recommended not to.
        
        xxhash is **NOT** a cryptographic hash function, it is a
        non-cryptographic hash algorithm aimed at speed and quality.
        Do not put xxhash in any position where cryptographic hash
        functions are required.
        
        
        Copyright and License
        ---------------------
        
        Copyright (c) 2014 Yue Du - https://github.com/ifduyue
        
        Licensed under `BSD 2-Clause License <http://opensource.org/licenses/BSD-2-Clause>`_
        
        
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
