safe-pysha3


Namesafe-pysha3 JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/5afe/pysha3
SummarySHA-3 (Keccak) for Python 3.9 - 3.11
upload_time2023-05-04 10:43:09
maintainerUxío Fuentefría
docs_urlNone
authorChristian Heimes
requires_python
licensePSFL (Keccak: CC0 1.0 Universal)
keywords sha3 sha-3 keccak hash
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======
pysha3
======

SHA-3 wrapper (keccak) for Python. The package is a wrapper around the
optimized Keccak Code Package, https://github.com/gvanas/KeccakCodePackage .

The module is a standalone version of my SHA-3 module from Python 3.6
(currently under development). The code in sha3module.c has been modified to
be compatible with Python 2.7 to 3.5. Python 2.6 and earlier are not
supported.


Updates since pysha 0.3
=======================

**pysha3 1.0 is not compatible with pysha3 0.3!**

pysha3 < 1.0 used the old Keccak implementation. During the finalization of
SHA3, NIST changed the delimiter suffix from 0x01 to 0x06. The Keccak sponge
function stayed the same. pysha3 1.0 provides the previous Keccak hash, too.


Platforms
=========

pysha3 has been successfully tested on several platforms:

 - Linux (GCC, clang) on X86, X86_64 and ARMv6 (little endian)
 - Windows (VS 2008, VS 2010, VS2015) on X86 and X86_64


Usage
=====

The `sha3` module contains several constructors for hash objects with a
PEP 247 compatible interface. The module provides SHA3, SHAKE and Keccak:

* `sha3_224()`, `sha3_256()`, `sha3_384()`, and `sha3_512()`
* `shake_128()`, `shake_256()`
* `keccak_224()`, `keccak_256()`, `keccak_384()`, and `keccak_512()`

The `sha3` module monkey patches the `hashlib` module . The monkey patch is
automatically activated with the first import of the `sha3` module. The
`hashlib` module of Python 3.6 will support the four SHA-3 algorithms and
the two SHAKE algorithms on all platforms. Therefore you shouldn't use the
sha3 module directly and rather go through the `hashlib` interface::

  >>> import sys
  >>> import hashlib
  >>> if sys.version_info < (3, 6):
  ...    import sha3
  >>> s = hashlib.sha3_512()
  >>> s.name
  'sha3_512'
  >>> s.digest_size
  64
  >>> s.update(b"data")
  >>> s.hexdigest()
  'ceca4daf960c2bbfb4a9edaca9b8137a801b65bae377e0f534ef9141c8684c0fedc1768d1afde9766572846c42b935f61177eaf97d355fa8dc2bca3fecfa754d'

  >>> s = hashlib.shake_256()
  >>> s.update(b"data")
  >>> s.hexdigest(4)
  'c73dbed8'
  >>> s.hexdigest(8)
  'c73dbed8527f5ae0'
  >>> s.hexdigest(16)
  'c73dbed8527f5ae0568679f30ecc5cb6'

  >>> import sha3
  >>> k = sha3.keccak_512()
  >>> k.update(b"data")
  >>> k.hexdigest()
  '1065aceeded3a5e4412e2187e919bffeadf815f5bd73d37fe00d384fe29f55f08462fdabe1007b993ce5b8119630e7db93101d9425d6e352e22ffe3dcb56b825'

Changelog
=========

pysha3 1.0.3-dev
----------------

*Unreleased*

- Fix typo in documentation (sha3_228 -> sha3_224)
- Add manylinux1 builder
- Don't use privat pystrhex.h

pysha3 1.0.2
------------

*Release: 05-Feb-2017*

- Rename internal C extension to _pysha3 to avoild conflict with Python 3.6'
  _sha3 extension.

pysha3 1.0.1
------------

*Release: 24-Jan-2017*

- Fix github.org -> github.com (Pi Delport)

- Fix endianness checks for Python 2 (William Grant)

- Fix changelog, the Christmas release was 1.0.0, not 1.1.0

pysha3 1.0.0
------------

*Release date: 24-Dec-2016*

- Synchronize with Python 3.6.0 release

- Move all backport related additions to backport.inc

- Fix flake8 violations


pysha3 1.0b1
------------

*Release date: 01-May-2016*

- Update backend to use the latest Keccak Code Package. pysha3 now implements
  the official NIST standard. The old Keccak hashes are available with
  keccak prefix.

- Add SHAKE support.

- All sha3, shake and keccak variants are separate types instead of factory
  functions that return the same type.

- Drop Python 2.6 and Python 3.0 to 3.3 support.

- Fix typo that disabled threading optimization.

- Add vector files for additional tests.

- Add experimental HMAC support based on examples from
  http://wolfgang-ehrhardt.de/hmac-sha3-testvectors.html .

- Test hashing of unaligned data.

- Add ISO C11 memset_s() function as _Py_memset_s() in order to securely
  wipe memory that holds sensitive data. The page
  https://www.securecoding.cert.org/confluence/display/seccode/MSC06-C.+Be+aware+of+compiler+optimization+when+dealing+with+sensitive+data
  explains the motivation for memset_s().

- Add tox support.

- Add Travis and appveyor integration.

- Add _capacity_bits, _rate_bits and _suffix attributes for diagnostic
  purposes.


pysha3 0.3
----------

*Release date: 14-Oct-2012*

- Fix 64bit big endian support

- Add workaround for alignment error on 64bit SPARC machine by using the opt32
  implementation.

- block_size now returns NotImplemented to prevent users from using pysha3
  with the hmac module.


pysha3 0.2.2
------------

*Release date: 07-Oct-2012*

- Re-add brg_endian.h to fix issue on Solaris (big endian platform)


pysha3 0.2.1
------------

*Release date: 06-Oct-2012*

- Fix MANIFEST.in to include Makefile and tests.py

- Add setup.py test command with hack for inplace builds

- Enhance README.txt and fixed its markup


pysha3 0.2
----------

*Release date: 06-Oct-2012*

- Change directory struct to use the same directory layout as Python 3.4.

- Remove C++ comments from Keccak sources for ANSI C compatibility.

- Declare all Keccak functions and globals as static to avoid name clashes.

- Remove alias sha3() for sha3_512().

- Add block_size attribute. Keccak has a internal sponge size of 1600 bits.

- Release GIL around SHA3_update() calls.

- Monkey patch the hashlib module to support, e.g. hashlib.sha3_512() and
  hashlib.new("sha3_512")

- Release GIL around SHA3_update() when the data exceeds a certain size.

- Fix build on platforms with an unsigned 64bit integer type (uint64_t). The
  module falls back to 32bit implementation of Keccak with interleave tables.


pysha3 0.1
----------

*Release date: 04-Oct-2012*

- first release

- based on KeccakReferenceAndOptimized-3.2.zip


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/5afe/pysha3",
    "name": "safe-pysha3",
    "maintainer": "Ux\u00edo Fuentefr\u00eda",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "uxio@safe.global",
    "keywords": "sha3 sha-3 keccak hash",
    "author": "Christian Heimes",
    "author_email": "christian@python.org",
    "download_url": "https://files.pythonhosted.org/packages/fd/73/67ba7ed2177b0b17d10665418fb5deafa03d76b8d4b2cb30883b81b00edf/safe-pysha3-1.0.4.tar.gz",
    "platform": "POSIX",
    "description": "======\npysha3\n======\n\nSHA-3 wrapper (keccak) for Python. The package is a wrapper around the\noptimized Keccak Code Package, https://github.com/gvanas/KeccakCodePackage .\n\nThe module is a standalone version of my SHA-3 module from Python 3.6\n(currently under development). The code in sha3module.c has been modified to\nbe compatible with Python 2.7 to 3.5. Python 2.6 and earlier are not\nsupported.\n\n\nUpdates since pysha 0.3\n=======================\n\n**pysha3 1.0 is not compatible with pysha3 0.3!**\n\npysha3 < 1.0 used the old Keccak implementation. During the finalization of\nSHA3, NIST changed the delimiter suffix from 0x01 to 0x06. The Keccak sponge\nfunction stayed the same. pysha3 1.0 provides the previous Keccak hash, too.\n\n\nPlatforms\n=========\n\npysha3 has been successfully tested on several platforms:\n\n - Linux (GCC, clang) on X86, X86_64 and ARMv6 (little endian)\n - Windows (VS 2008, VS 2010, VS2015) on X86 and X86_64\n\n\nUsage\n=====\n\nThe `sha3` module contains several constructors for hash objects with a\nPEP 247 compatible interface. The module provides SHA3, SHAKE and Keccak:\n\n* `sha3_224()`, `sha3_256()`, `sha3_384()`, and `sha3_512()`\n* `shake_128()`, `shake_256()`\n* `keccak_224()`, `keccak_256()`, `keccak_384()`, and `keccak_512()`\n\nThe `sha3` module monkey patches the `hashlib` module . The monkey patch is\nautomatically activated with the first import of the `sha3` module. The\n`hashlib` module of Python 3.6 will support the four SHA-3 algorithms and\nthe two SHAKE algorithms on all platforms. Therefore you shouldn't use the\nsha3 module directly and rather go through the `hashlib` interface::\n\n  >>> import sys\n  >>> import hashlib\n  >>> if sys.version_info < (3, 6):\n  ...    import sha3\n  >>> s = hashlib.sha3_512()\n  >>> s.name\n  'sha3_512'\n  >>> s.digest_size\n  64\n  >>> s.update(b\"data\")\n  >>> s.hexdigest()\n  'ceca4daf960c2bbfb4a9edaca9b8137a801b65bae377e0f534ef9141c8684c0fedc1768d1afde9766572846c42b935f61177eaf97d355fa8dc2bca3fecfa754d'\n\n  >>> s = hashlib.shake_256()\n  >>> s.update(b\"data\")\n  >>> s.hexdigest(4)\n  'c73dbed8'\n  >>> s.hexdigest(8)\n  'c73dbed8527f5ae0'\n  >>> s.hexdigest(16)\n  'c73dbed8527f5ae0568679f30ecc5cb6'\n\n  >>> import sha3\n  >>> k = sha3.keccak_512()\n  >>> k.update(b\"data\")\n  >>> k.hexdigest()\n  '1065aceeded3a5e4412e2187e919bffeadf815f5bd73d37fe00d384fe29f55f08462fdabe1007b993ce5b8119630e7db93101d9425d6e352e22ffe3dcb56b825'\n\nChangelog\n=========\n\npysha3 1.0.3-dev\n----------------\n\n*Unreleased*\n\n- Fix typo in documentation (sha3_228 -> sha3_224)\n- Add manylinux1 builder\n- Don't use privat pystrhex.h\n\npysha3 1.0.2\n------------\n\n*Release: 05-Feb-2017*\n\n- Rename internal C extension to _pysha3 to avoild conflict with Python 3.6'\n  _sha3 extension.\n\npysha3 1.0.1\n------------\n\n*Release: 24-Jan-2017*\n\n- Fix github.org -> github.com (Pi Delport)\n\n- Fix endianness checks for Python 2 (William Grant)\n\n- Fix changelog, the Christmas release was 1.0.0, not 1.1.0\n\npysha3 1.0.0\n------------\n\n*Release date: 24-Dec-2016*\n\n- Synchronize with Python 3.6.0 release\n\n- Move all backport related additions to backport.inc\n\n- Fix flake8 violations\n\n\npysha3 1.0b1\n------------\n\n*Release date: 01-May-2016*\n\n- Update backend to use the latest Keccak Code Package. pysha3 now implements\n  the official NIST standard. The old Keccak hashes are available with\n  keccak prefix.\n\n- Add SHAKE support.\n\n- All sha3, shake and keccak variants are separate types instead of factory\n  functions that return the same type.\n\n- Drop Python 2.6 and Python 3.0 to 3.3 support.\n\n- Fix typo that disabled threading optimization.\n\n- Add vector files for additional tests.\n\n- Add experimental HMAC support based on examples from\n  http://wolfgang-ehrhardt.de/hmac-sha3-testvectors.html .\n\n- Test hashing of unaligned data.\n\n- Add ISO C11 memset_s() function as _Py_memset_s() in order to securely\n  wipe memory that holds sensitive data. The page\n  https://www.securecoding.cert.org/confluence/display/seccode/MSC06-C.+Be+aware+of+compiler+optimization+when+dealing+with+sensitive+data\n  explains the motivation for memset_s().\n\n- Add tox support.\n\n- Add Travis and appveyor integration.\n\n- Add _capacity_bits, _rate_bits and _suffix attributes for diagnostic\n  purposes.\n\n\npysha3 0.3\n----------\n\n*Release date: 14-Oct-2012*\n\n- Fix 64bit big endian support\n\n- Add workaround for alignment error on 64bit SPARC machine by using the opt32\n  implementation.\n\n- block_size now returns NotImplemented to prevent users from using pysha3\n  with the hmac module.\n\n\npysha3 0.2.2\n------------\n\n*Release date: 07-Oct-2012*\n\n- Re-add brg_endian.h to fix issue on Solaris (big endian platform)\n\n\npysha3 0.2.1\n------------\n\n*Release date: 06-Oct-2012*\n\n- Fix MANIFEST.in to include Makefile and tests.py\n\n- Add setup.py test command with hack for inplace builds\n\n- Enhance README.txt and fixed its markup\n\n\npysha3 0.2\n----------\n\n*Release date: 06-Oct-2012*\n\n- Change directory struct to use the same directory layout as Python 3.4.\n\n- Remove C++ comments from Keccak sources for ANSI C compatibility.\n\n- Declare all Keccak functions and globals as static to avoid name clashes.\n\n- Remove alias sha3() for sha3_512().\n\n- Add block_size attribute. Keccak has a internal sponge size of 1600 bits.\n\n- Release GIL around SHA3_update() calls.\n\n- Monkey patch the hashlib module to support, e.g. hashlib.sha3_512() and\n  hashlib.new(\"sha3_512\")\n\n- Release GIL around SHA3_update() when the data exceeds a certain size.\n\n- Fix build on platforms with an unsigned 64bit integer type (uint64_t). The\n  module falls back to 32bit implementation of Keccak with interleave tables.\n\n\npysha3 0.1\n----------\n\n*Release date: 04-Oct-2012*\n\n- first release\n\n- based on KeccakReferenceAndOptimized-3.2.zip\n\n",
    "bugtrack_url": null,
    "license": "PSFL (Keccak: CC0 1.0 Universal)",
    "summary": "SHA-3 (Keccak) for Python 3.9 - 3.11",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/5afe/pysha3"
    },
    "split_keywords": [
        "sha3",
        "sha-3",
        "keccak",
        "hash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd7367ba7ed2177b0b17d10665418fb5deafa03d76b8d4b2cb30883b81b00edf",
                "md5": "bb84b7bf16df6f86fbdf07b40eb16f07",
                "sha256": "e429146b1edd198b2ca934a2046a65656c5d31b0ec894bbd6055127f4deaff17"
            },
            "downloads": -1,
            "filename": "safe-pysha3-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "bb84b7bf16df6f86fbdf07b40eb16f07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 827688,
            "upload_time": "2023-05-04T10:43:09",
            "upload_time_iso_8601": "2023-05-04T10:43:09.971542Z",
            "url": "https://files.pythonhosted.org/packages/fd/73/67ba7ed2177b0b17d10665418fb5deafa03d76b8d4b2cb30883b81b00edf/safe-pysha3-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-04 10:43:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "5afe",
    "github_project": "pysha3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "appveyor": true,
    "tox": true,
    "lcname": "safe-pysha3"
}
        
Elapsed time: 0.48248s