[Python-modules-commits] [python-nacl] 01/06: Import python-nacl_1.1.1.orig.tar.gz

Tristan Seligmann mithrandi at moszumanska.debian.org
Sun Mar 19 14:55:57 UTC 2017


This is an automated email from the git hooks/post-receive script.

mithrandi pushed a commit to branch master
in repository python-nacl.

commit e925e95339cfd8c88258616b2dd0ff9f91449860
Author: Tristan Seligmann <mithrandi at debian.org>
Date:   Fri Mar 17 15:49:27 2017 +0200

    Import python-nacl_1.1.1.orig.tar.gz
---
 MANIFEST.in                                        |     6 +
 PKG-INFO                                           |    37 +-
 README.rst                                         |    33 +-
 docs/api/hash.rst                                  |    42 +
 docs/api/hashlib.rst                               |    79 +
 docs/exceptions.rst                                |    54 +
 docs/hashing.rst                                   |   170 +
 docs/index.rst                                     |    17 +
 docs/password_hashing.rst                          |   133 +
 docs/public.rst                                    |    62 +-
 docs/secret.rst                                    |    39 +-
 docs/signing.rst                                   |     4 +-
 docs/utils.rst                                     |    26 +-
 setup.py                                           |    37 +-
 src/PyNaCl.egg-info/PKG-INFO                       |    37 +-
 src/PyNaCl.egg-info/SOURCES.txt                    |    69 +-
 src/PyNaCl.egg-info/requires.txt                   |     2 +-
 src/bindings/crypto_generichash.h                  |    61 +
 src/bindings/crypto_pwhash_scryptsalsa208sha256.h  |    40 +
 src/bindings/crypto_shorthash.h                    |    23 +
 src/bindings/utils.h                               |    20 +
 src/libsodium/AUTHORS                              |    14 +
 src/libsodium/ChangeLog                            |    54 +
 src/libsodium/LICENSE                              |     4 +-
 src/libsodium/Makefile.am                          |     1 +
 src/libsodium/Makefile.in                          |    16 +-
 src/libsodium/README                               |     1 -
 src/libsodium/README.markdown                      |     7 +
 src/libsodium/aclocal.m4                           |     2 +
 src/libsodium/configure                            |  2558 ++-
 src/libsodium/configure.ac                         |   167 +-
 src/libsodium/dist-build/Makefile.am               |     6 +-
 src/libsodium/dist-build/Makefile.in               |    20 +-
 src/libsodium/dist-build/android-armv8-a.sh        |     2 +-
 src/libsodium/dist-build/android-build.sh          |    43 +-
 src/libsodium/dist-build/android-mips64.sh         |     2 +-
 src/libsodium/dist-build/android-x86-64.sh         |     4 -
 src/libsodium/dist-build/android-x86_64.sh         |     4 +
 src/libsodium/dist-build/emscripten.sh             |   102 +-
 src/libsodium/dist-build/msys2-win32.sh            |    10 +-
 src/libsodium/dist-build/msys2-win64.sh            |    10 +-
 .../{nativeclient.sh => nativeclient-pnacl.sh}     |     7 +-
 src/libsodium/dist-build/nativeclient-x86.sh       |    19 +
 src/libsodium/dist-build/nativeclient-x86_64.sh    |    19 +
 src/libsodium/libsodium-uninstalled.pc.in          |     2 +-
 src/libsodium/libsodium.pc.in                      |     2 +-
 src/libsodium/libsodium.vcxproj                    |   136 +-
 src/libsodium/libsodium.vcxproj.filters            |   396 +-
 src/libsodium/m4/ax_pthread.m4                     |   485 +
 src/libsodium/m4/ax_valgrind_check.m4              |   190 +
 src/libsodium/msvc-scripts/Makefile.in             |    14 +
 src/libsodium/msvc-scripts/process.bat             |     4 +-
 src/libsodium/src/Makefile.in                      |    14 +
 src/libsodium/src/libsodium/Makefile.am            |    44 +-
 src/libsodium/src/libsodium/Makefile.in            |   327 +-
 .../aes256gcm/aesni/aead_aes256gcm_aesni.c         |   425 +-
 .../sodium/aead_chacha20poly1305.c                 |   332 +-
 .../src/libsodium/crypto_box/crypto_box_seal.c     |     4 +-
 .../ref/before_curve25519xsalsa20poly1305.c        |     5 +-
 .../curve25519/ref10/curve25519_ref10.c            |  3591 ++--
 .../crypto_core/hchacha20/core_hchacha20.c         |    86 +
 .../crypto_core/hchacha20/core_hchacha20.h         |    28 +
 .../crypto_core/hsalsa20/ref2/core_hsalsa20.c      |    84 +-
 .../crypto_core/salsa20/ref/core_salsa20.c         |   102 +-
 .../crypto_core/salsa2012/ref/core_salsa2012.c     |   102 +-
 .../crypto_core/salsa208/ref/core_salsa208.c       |   102 +-
 .../blake2/generichash_blake2_api.c                |     7 +
 .../crypto_generichash/blake2/ref/blake2-impl.h    |    89 -
 .../crypto_generichash/blake2/ref/blake2.h         |   191 +-
 .../blake2/ref/blake2b-compress-avx2.c             |    45 +
 .../blake2/ref/blake2b-compress-avx2.h             |   123 +
 .../blake2/ref/blake2b-compress-ref.c              |     5 +-
 .../blake2/ref/blake2b-compress-sse41.c            |     4 +-
 .../{blake2b-round.h => blake2b-compress-sse41.h}  |    30 +-
 .../blake2/ref/blake2b-compress-ssse3.c            |     6 +-
 .../{blake2b-round.h => blake2b-compress-ssse3.h}  |    30 +-
 .../blake2/ref/blake2b-load-avx2.h                 |   339 +
 .../blake2/ref/blake2b-load-sse2.h                 |     2 -
 .../blake2/ref/blake2b-load-sse41.h                |     2 -
 .../crypto_generichash/blake2/ref/blake2b-ref.c    |    57 +-
 .../libsodium/crypto_hash/sha256/cp/hash_sha256.c  |    62 +-
 .../libsodium/crypto_hash/sha512/cp/hash_sha512.c  |    57 +-
 .../poly1305/donna/poly1305_donna.h                |    21 +-
 .../poly1305/donna/poly1305_donna32.h              |    63 +-
 .../poly1305/donna/poly1305_donna64.h              |    51 +-
 .../poly1305/sse2/poly1305_sse2.c                  |     6 +-
 .../poly1305/sse2/poly1305_sse2.h                  |    21 +-
 .../libsodium/crypto_pwhash/argon2/argon2-core.c   |   570 +
 .../libsodium/crypto_pwhash/argon2/argon2-core.h   |   198 +
 .../crypto_pwhash/argon2/argon2-encoding.c         |   443 +
 .../crypto_pwhash/argon2/argon2-encoding.h         |    32 +
 .../crypto_pwhash/argon2/argon2-fill-block-ref.c   |   229 +
 .../crypto_pwhash/argon2/argon2-fill-block-ssse3.c |   222 +
 .../libsodium/crypto_pwhash/argon2/argon2-impl.h   |    40 +
 .../src/libsodium/crypto_pwhash/argon2/argon2.c    |   242 +
 .../src/libsodium/crypto_pwhash/argon2/argon2.h    |   251 +
 .../libsodium/crypto_pwhash/argon2/blake2b-long.c  |    80 +
 .../libsodium/crypto_pwhash/argon2/blake2b-long.h  |     8 +
 .../crypto_pwhash/argon2/blamka-round-ref.h        |    38 +
 .../crypto_pwhash/argon2/blamka-round-ssse3.h      |   117 +
 .../crypto_pwhash/argon2/pwhash_argon2i.c          |   164 +
 .../src/libsodium/crypto_pwhash/crypto_pwhash.c    |   106 +
 .../scryptsalsa208sha256/crypto_scrypt-common.c    |     2 +-
 .../scryptsalsa208sha256/crypto_scrypt.h           |     8 +-
 .../nosse/pwhash_scryptsalsa208sha256_nosse.c      |   372 +-
 .../scryptsalsa208sha256/pbkdf2-sha256.c           |     4 +-
 .../pwhash_scryptsalsa208sha256.c                  |     5 +-
 .../scryptsalsa208sha256/scrypt_platform.c         |    66 +-
 .../sse/pwhash_scryptsalsa208sha256_sse.c          |   510 +-
 .../crypto_pwhash/scryptsalsa208sha256/sysendian.h |   146 -
 .../curve25519/donna_c64/curve25519_donna_c64.c    |    35 +-
 .../curve25519/donna_c64/curve25519_donna_c64.h    |     1 +
 .../curve25519/ref10/x25519_ref10.c                |    24 +-
 .../curve25519/ref10/x25519_ref10.h                |     5 +-
 .../curve25519/sandy2x/consts_namespace.h          |     2 +-
 .../crypto_scalarmult/curve25519/sandy2x/fe.h      |     5 +-
 .../crypto_scalarmult/curve25519/sandy2x/fe51.h    |     8 +-
 .../curve25519/sandy2x/fe51_invert.c               |    82 +-
 .../curve25519/sandy2x/fe51_mul.S                  |    12 +-
 .../curve25519/sandy2x/fe51_namespace.h            |     2 +-
 .../curve25519/sandy2x/fe51_nsquare.S              |     7 +
 .../curve25519/sandy2x/fe51_pack.S                 |     7 +
 .../curve25519/sandy2x/fe_frombytes_sandy2x.c      |    63 +-
 .../crypto_scalarmult/curve25519/sandy2x/ladder.S  |  1660 +-
 .../crypto_scalarmult/curve25519/sandy2x/ladder.h  |     2 +-
 .../curve25519/sandy2x/ladder_base.S               |  1464 +-
 .../curve25519/sandy2x/ladder_base.h               |     2 +-
 .../curve25519/sandy2x/ladder_base_namespace.h     |     2 +-
 .../curve25519/sandy2x/ladder_namespace.h          |     2 +-
 .../crypto_secretbox/crypto_secretbox_easy.c       |    11 +-
 .../siphash24/ref/shorthash_siphash24.c            |    36 +-
 .../libsodium/crypto_sign/ed25519/ref10/keypair.c  |     2 +-
 .../libsodium/crypto_sign/ed25519/ref10/obsolete.c |     2 +-
 .../src/libsodium/crypto_sign/ed25519/ref10/open.c |    77 +-
 .../src/libsodium/crypto_sign/ed25519/ref10/sign.c |     2 +-
 .../aes128ctr/portable/afternm_aes128ctr.c         |    12 +-
 .../crypto_stream/aes128ctr/portable/common.h      |    19 +-
 .../aes128ctr/portable/common_aes128ctr.c          |    64 -
 .../crypto_stream/aes128ctr/portable/int128.h      |     2 +-
 .../aes128ctr/portable/int128_aes128ctr.c          |    40 +-
 .../crypto_stream/aes128ctr/portable/types.h       |     8 +-
 .../aes128ctr/portable/xor_afternm_aes128ctr.c     |    12 +-
 .../chacha20/ref/stream_chacha20_ref.c             |   133 +-
 .../chacha20/ref/stream_chacha20_ref.h             |     1 +
 .../chacha20/vec/stream_chacha20_vec.h             |     1 +
 .../salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S |     8 +
 .../crypto_stream/salsa20/ref/stream_salsa20_ref.c |    10 +-
 .../crypto_stream/salsa20/ref/xor_salsa20_ref.c    |    10 +-
 .../crypto_stream/salsa2012/ref/stream_salsa2012.c |    10 +-
 .../crypto_stream/salsa2012/ref/xor_salsa2012.c    |    10 +-
 .../crypto_stream/salsa208/ref/stream_salsa208.c   |    10 +-
 .../crypto_stream/salsa208/ref/xor_salsa208.c      |    10 +-
 .../crypto_stream/xsalsa20/ref/stream_xsalsa20.c   |     6 +-
 .../crypto_stream/xsalsa20/ref/xor_xsalsa20.c      |     6 +-
 src/libsodium/src/libsodium/include/Makefile.am    |     3 +
 src/libsodium/src/libsodium/include/Makefile.in    |    32 +-
 src/libsodium/src/libsodium/include/sodium.h       |     3 +
 .../include/sodium/crypto_aead_aes256gcm.h         |    52 +-
 .../include/sodium/crypto_aead_chacha20poly1305.h  |   118 +-
 .../src/libsodium/include/sodium/crypto_auth.h     |     2 +-
 .../include/sodium/crypto_auth_hmacsha256.h        |     2 +-
 .../include/sodium/crypto_auth_hmacsha512.h        |     2 +-
 .../include/sodium/crypto_auth_hmacsha512256.h     |     2 +-
 .../src/libsodium/include/sodium/crypto_box.h      |     6 +-
 .../sodium/crypto_box_curve25519xsalsa20poly1305.h |    14 +-
 .../include/sodium/crypto_core_hchacha20.h         |    35 +
 .../libsodium/include/sodium/crypto_generichash.h  |     2 +-
 .../include/sodium/crypto_generichash_blake2b.h    |     5 +-
 .../src/libsodium/include/sodium/crypto_hash.h     |     2 +-
 .../libsodium/include/sodium/crypto_hash_sha256.h  |     2 +-
 .../libsodium/include/sodium/crypto_hash_sha512.h  |     2 +-
 .../libsodium/include/sodium/crypto_onetimeauth.h  |     2 +-
 .../include/sodium/crypto_onetimeauth_poly1305.h   |     2 +-
 .../src/libsodium/include/sodium/crypto_pwhash.h   |    89 +
 .../include/sodium/crypto_pwhash_argon2i.h         |    86 +
 .../sodium/crypto_pwhash_scryptsalsa208sha256.h    |     2 +-
 .../libsodium/include/sodium/crypto_secretbox.h    |     2 +-
 .../sodium/crypto_secretbox_xsalsa20poly1305.h     |    14 +-
 .../libsodium/include/sodium/crypto_shorthash.h    |     2 +-
 .../include/sodium/crypto_shorthash_siphash24.h    |     2 +-
 .../src/libsodium/include/sodium/crypto_sign.h     |     6 +-
 .../libsodium/include/sodium/crypto_sign_ed25519.h |     2 +-
 .../sodium/crypto_sign_edwards25519sha512batch.h   |    13 +-
 .../src/libsodium/include/sodium/crypto_stream.h   |     2 +-
 .../include/sodium/crypto_stream_aes128ctr.h       |     2 +-
 .../include/sodium/crypto_stream_chacha20.h        |     2 +-
 .../include/sodium/crypto_stream_salsa20.h         |     2 +-
 .../include/sodium/crypto_stream_salsa2012.h       |     2 +-
 .../include/sodium/crypto_stream_salsa208.h        |     2 +-
 .../include/sodium/crypto_stream_xsalsa20.h        |     2 +-
 .../src/libsodium/include/sodium/private/common.h  |   150 +
 .../sodium/private}/curve25519_ref10.h             |    82 +-
 .../src/libsodium/include/sodium/private/mutex.h   |     7 +
 .../src/libsodium/include/sodium/randombytes.h     |     2 +-
 .../src/libsodium/include/sodium/runtime.h         |     3 +
 .../nativeclient/randombytes_nativeclient.c        |    19 +-
 .../src/libsodium/randombytes/randombytes.c        |    43 +-
 .../salsa20/randombytes_salsa20_random.c           |    93 +-
 .../randombytes/sysrandom/randombytes_sysrandom.c  |    47 +-
 src/libsodium/src/libsodium/sodium/core.c          |   137 +-
 src/libsodium/src/libsodium/sodium/runtime.c       |    61 +-
 src/libsodium/src/libsodium/sodium/utils.c         |    51 +-
 src/libsodium/test/Makefile.in                     |    14 +
 src/libsodium/test/default/Makefile.am             |    10 +
 src/libsodium/test/default/Makefile.in             |    78 +-
 src/libsodium/test/default/aead_aes256gcm.c        |    62 +-
 src/libsodium/test/default/aead_chacha20poly1305.c |   275 +-
 src/libsodium/test/default/auth7.c                 |    10 +-
 src/libsodium/test/default/box.c                   |     8 +-
 src/libsodium/test/default/box2.c                  |     2 +-
 src/libsodium/test/default/core6.c                 |     2 +-
 src/libsodium/test/default/generichash.c           |    13 +-
 src/libsodium/test/default/generichash2.c          |    14 +-
 src/libsodium/test/default/generichash3.c          |    21 +
 src/libsodium/test/default/pwhash.c                |   354 +-
 src/libsodium/test/default/pwhash.exp              |    41 +-
 .../test/default/{pwhash.c => pwhash_scrypt.c}     |     2 +-
 .../test/default/{pwhash.exp => pwhash_scrypt.exp} |     0
 src/libsodium/test/default/randombytes.c           |     6 +-
 src/libsodium/test/default/secretbox.c             |     2 +-
 src/libsodium/test/default/secretbox2.c            |     2 +-
 src/libsodium/test/default/sign.c                  |    15 +
 src/libsodium/test/default/sodium_utils2.c         |    11 +-
 src/libsodium/test/default/sodium_utils3.c         |     6 +-
 src/libsodium/test/default/verify1.c               |     4 -
 src/libsodium/test/quirks/quirks.h                 |    28 +-
 src/nacl/__init__.py                               |     2 +-
 src/nacl/bindings/__init__.py                      |    63 +
 src/nacl/bindings/crypto_box.py                    |    55 +-
 src/nacl/bindings/crypto_generichash.py            |   215 +
 src/nacl/bindings/crypto_hash.py                   |    14 +-
 src/nacl/bindings/crypto_pwhash.py                 |   225 +
 src/nacl/bindings/crypto_scalarmult.py             |    10 +-
 src/nacl/bindings/crypto_secretbox.py              |    22 +-
 src/nacl/bindings/crypto_shorthash.py              |    40 +
 src/nacl/bindings/crypto_sign.py                   |    31 +-
 src/nacl/bindings/sodium_core.py                   |    14 +-
 src/nacl/bindings/utils.py                         |    41 +
 src/nacl/exceptions.py                             |    41 +
 src/nacl/hash.py                                   |    75 +
 src/nacl/hashlib.py                                |   115 +
 src/nacl/public.py                                 |    79 +-
 src/nacl/pwhash.py                                 |   119 +
 src/nacl/secret.py                                 |    28 +-
 src/nacl/signing.py                                |    36 +-
 src/nacl/utils.py                                  |     7 +
 tests/data/blake2-kat.json                         | 18434 +++++++++++++++++++
 ...est-vectors-blake2-nosalt-nopersonalization.txt |    47 +
 ...to-test-vectors-blake2-salt-personalization.txt |    47 +
 tests/test_box.py                                  |    44 +
 tests/test_exc.py                                  |    43 +
 tests/test_generichash.py                          |   186 +
 tests/test_hashlib_scrypt.py                       |    90 +
 tests/test_public.py                               |   110 +
 tests/test_pwhash.py                               |   188 +
 tests/test_secret.py                               |    25 +
 tests/test_shorthash.py                            |   138 +
 tests/test_signing.py                              |    44 +
 src/nacl/exceptions.py => tests/utils.py           |    16 +-
 tox.ini                                            |     5 +-
 260 files changed, 35167 insertions(+), 7166 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index 72fc28e..fc2f2af 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -36,3 +36,9 @@ exclude .travis.yml
 exclude .travis
 exclude .travis/install.sh
 exclude .travis/run.sh
+
+# Remove the coverage config
+exclude .coveragerc
+
+# Remove release automation script
+exclude tasks.py
diff --git a/PKG-INFO b/PKG-INFO
index 9020164..2e9547d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: PyNaCl
-Version: 1.0.1
+Version: 1.1.1
 Summary: Python binding to the Networking and Cryptography (NaCl) library
 Home-page: https://github.com/pyca/pynacl/
 Author: The PyNaCl developers
@@ -9,19 +9,20 @@ License: Apache License 2.0
 Description: PyNaCl
         ======
         
-        .. image:: https://pypip.in/version/PyNaCl/badge.svg?style=flat
+        .. image:: https://img.shields.io/pypi/v/pynacl.svg
             :target: https://pypi.python.org/pypi/PyNaCl/
             :alt: Latest Version
         
         .. image:: https://travis-ci.org/pyca/pynacl.svg?branch=master
             :target: https://travis-ci.org/pyca/pynacl
         
-        .. image:: https://coveralls.io/repos/pyca/pynacl/badge.svg?branch=master
-           :target: https://coveralls.io/r/pyca/pynacl?branch=master
+        .. image:: https://codecov.io/github/pyca/pynacl/coverage.svg?branch=master
+            :target: https://codecov.io/github/pyca/pynacl?branch=master
         
-        PyNaCl is a Python binding to the `Networking and Cryptography library`_,
-        a crypto library with the stated goal of improving usability, security and
-        speed.
+        PyNaCl is a Python binding to `libsodium`_, which is a fork of the
+        `Networking and Cryptography library`_. These libraries have a stated goal of
+        improving usability, security and speed. It supports Python 2.7 and 3.3+ as
+        well as PyPy 2.6+.
         
         .. _Networking and Cryptography library: https://nacl.cr.yp.to/
         
@@ -33,7 +34,7 @@ Description: PyNaCl
         Linux
         ~~~~~
         
-        PyNaCl relies on libsodium_, a portable C library. A copy is bundled
+        PyNaCl relies on `libsodium`_, a portable C library. A copy is bundled
         with PyNaCl so to install you can run:
         
         .. code-block:: console
@@ -72,6 +73,24 @@ Description: PyNaCl
         Changes
         -------
         
+        * 1.1.1 - 2017-03-15:
+        
+          * Fixed a circular import bug in ``nacl.utils``.
+        
+        * 1.1.0 - 2017-03-14:
+        
+          * Dropped support for Python 2.6.
+          * Added ``shared_key()`` method on ``Box``.
+          * You can now pass ``None`` to ``nonce`` when encrypting with ``Box`` or
+            ``SecretBox`` and it will automatically generate a random nonce.
+          * Added support for ``siphash24``.
+          * Added support for ``blake2b``.
+          * Added support for ``scrypt``.
+          * Update ``libsodium`` to 1.0.11.
+          * Default to the bundled ``libsodium`` when compiling.
+          * All raised exceptions are defined mixing-in
+            ``nacl.exceptions.CryptoError``
+        
         * 1.0.1:
         
           * Fix an issue with absolute paths that prevented the creation of wheels.
@@ -100,9 +119,9 @@ Platform: UNKNOWN
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 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.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
diff --git a/README.rst b/README.rst
index 93642f7..f936dcf 100644
--- a/README.rst
+++ b/README.rst
@@ -1,19 +1,20 @@
 PyNaCl
 ======
 
-.. image:: https://pypip.in/version/PyNaCl/badge.svg?style=flat
+.. image:: https://img.shields.io/pypi/v/pynacl.svg
     :target: https://pypi.python.org/pypi/PyNaCl/
     :alt: Latest Version
 
 .. image:: https://travis-ci.org/pyca/pynacl.svg?branch=master
     :target: https://travis-ci.org/pyca/pynacl
 
-.. image:: https://coveralls.io/repos/pyca/pynacl/badge.svg?branch=master
-   :target: https://coveralls.io/r/pyca/pynacl?branch=master
+.. image:: https://codecov.io/github/pyca/pynacl/coverage.svg?branch=master
+    :target: https://codecov.io/github/pyca/pynacl?branch=master
 
-PyNaCl is a Python binding to the `Networking and Cryptography library`_,
-a crypto library with the stated goal of improving usability, security and
-speed.
+PyNaCl is a Python binding to `libsodium`_, which is a fork of the
+`Networking and Cryptography library`_. These libraries have a stated goal of
+improving usability, security and speed. It supports Python 2.7 and 3.3+ as
+well as PyPy 2.6+.
 
 .. _Networking and Cryptography library: https://nacl.cr.yp.to/
 
@@ -25,7 +26,7 @@ Installation
 Linux
 ~~~~~
 
-PyNaCl relies on libsodium_, a portable C library. A copy is bundled
+PyNaCl relies on `libsodium`_, a portable C library. A copy is bundled
 with PyNaCl so to install you can run:
 
 .. code-block:: console
@@ -64,6 +65,24 @@ Features
 Changes
 -------
 
+* 1.1.1 - 2017-03-15:
+
+  * Fixed a circular import bug in ``nacl.utils``.
+
+* 1.1.0 - 2017-03-14:
+
+  * Dropped support for Python 2.6.
+  * Added ``shared_key()`` method on ``Box``.
+  * You can now pass ``None`` to ``nonce`` when encrypting with ``Box`` or
+    ``SecretBox`` and it will automatically generate a random nonce.
+  * Added support for ``siphash24``.
+  * Added support for ``blake2b``.
+  * Added support for ``scrypt``.
+  * Update ``libsodium`` to 1.0.11.
+  * Default to the bundled ``libsodium`` when compiling.
+  * All raised exceptions are defined mixing-in
+    ``nacl.exceptions.CryptoError``
+
 * 1.0.1:
 
   * Fix an issue with absolute paths that prevented the creation of wheels.
diff --git a/docs/api/hash.rst b/docs/api/hash.rst
index 2e1e62e..40d4b7f 100644
--- a/docs/api/hash.rst
+++ b/docs/api/hash.rst
@@ -18,3 +18,45 @@ nacl.hash
     :param bytes message: The message to hash.
     :param encoder: A class that is able to encode the hashed message.
     :return bytes: The hashed message.
+
+.. function:: blake2b(data, digest_size=BLAKE2B_BYTES, key=b'', \
+                      salt=b'', person=b'', encoder=nacl.encoding.HexEncoder)
+
+    One-shot blake2b digest
+
+    :param data: the digest input byte sequence
+    :type data: bytes
+    :param digest_size: the requested digest size; must be at most
+                        :py:data:`.BLAKE2B_BYTES_MAX`;
+                        the default digest size is :py:data:`.BLAKE2B_BYTES`
+    :type digest_size: int
+    :param key: the key to be set for keyed MAC/PRF usage; if set, the key
+                must be at most :py:data:`.BLAKE2B_KEYBYTES_MAX` long
+    :type key: bytes
+    :param salt: an initialization salt at most
+                 :py:data:`.BLAKE2B_SALTBYTES` long; it will be zero-padded
+                 if needed
+    :type salt: bytes
+    :param person: a personalization string at most
+                     :py:data:`.BLAKE2B_PERSONALBYTES` long; it will be
+                     zero-padded if needed
+    :type person: bytes
+    :param encoder: the encoder to use on returned digest
+    :type encoder: class
+    :return: encoded bytes data
+    :rtype: the return type of the choosen encoder
+
+
+.. function:: siphash24(message, key=b'', encoder=nacl.encoding.HexEncoder)
+
+    Computes a keyed MAC of ``message`` using siphash-2-4
+
+    :param message: The message to hash.
+    :type message: bytes
+    :param key: the message authentication key to be used
+                It must be a :py:data:`.SIPHASH_KEYBYTES` long
+                bytes sequence
+    :type key: bytes(:py:data:`.SIPHASH_KEYBYTES`)
+    :param encoder: A class that is able to encode the hashed message.
+    :return: The hashed message.
+    :rtype: bytes(:py:data:`.SIPHASH_BYTES`) long bytes sequence
diff --git a/docs/api/hashlib.rst b/docs/api/hashlib.rst
new file mode 100644
index 0000000..e275f43
--- /dev/null
+++ b/docs/api/hashlib.rst
@@ -0,0 +1,79 @@
+nacl.hashlib
+============
+
+.. currentmodule:: nacl.hashlib
+
+The :py:mod:`nacl.hashlib` module exposes directly usable implementations
+of raw constructs which libsodium exposes with simplified APIs, like the
+ones in :py:mod:`nacl.hash` and in :py:mod:`nacl.pwhash`.
+
+The :py:class:`~.blake2b` and :py:func:`~.scrypt` implementations
+are as API compatible as possible with the corresponding ones added
+to cpython standard library's hashlib module in cpython's version 3.6.
+
+
+.. class:: blake2b(data=b'', digest_size=BYTES, key=b'', salt=b'', person=b'')
+
+    Returns an hash object which exposes an API mostly compatible
+    to python3.6's hashlib.blake2b (the only difference being missing
+    support for tree hashing parameters in the contructor)
+
+    The methods :py:func:`update`, :py:func:`copy`,
+    :func:`digest` and :func:`hexdigest` have the same semantics
+    as described in hashlib documentation.
+
+    Each instance exposes the :py:attr:`digest_size`, :py:attr:`block_size`
+    :py:attr:`name` properties as required by hashlib API.
+
+    .. attribute:: MAX_DIGEST_SIZE
+
+        the maximum allowed value of the requested digest_size
+
+    .. attribute:: MAX_KEY_SIZE
+
+        the maximum allowed size of the password parameter
+
+    .. attribute:: PERSON_SIZE
+
+        the maximimum size of the personalization
+
+    .. attribute:: SALT_SIZE
+
+        the maximimum size of the salt
+
+
+.. function:: scrypt(password, salt='', n=2**20, r=8, p=1,\
+                     maxmem=2**25, dklen=64)
+
+    Derive a raw cryptographic key using the scrypt KDF.
+
+    :param password: the input password
+    :type password: bytes
+    :param salt: a crypographically-strong random salt
+    :type salt: bytes
+    :param n: CPU/Memory cost factor
+    :type n: int
+    :param r: block size multiplier: the used block size will be 128 * r
+    :type r: int
+    :param p: requested parallelism: the number of indipendently running
+              scrypt constructs which will contribute to the final key
+              generation
+    :type p: int
+    :param maxmem: maximum memory the whole scrypt construct will be
+                   entitled to use
+    :type maxmem: int
+    :param dklen: length of the derived key
+    :type dklen: int
+    :return: a buffer dklen bytes long containing the derived key
+
+    Implements the same signature as the ``hashlib.scrypt`` implemented
+    in cpython version 3.6
+
+    The recommended values for n, r, p in 2012 were n = 2**14, r = 8, p = 1;
+    as of 2016, libsodium suggests using n = 2**14, r = 8, p = 1
+    in a "interactive" setting and n = 2**20, r = 8, p = 1
+    in a "sensitive" setting.
+
+    The total memory usage will respectively be a little greater than 16MB
+    in the "interactive" setting, and a little greater than 1GB in the
+    "sensitive" setting.
diff --git a/docs/exceptions.rst b/docs/exceptions.rst
index 6de01fe..f99dc7c 100644
--- a/docs/exceptions.rst
+++ b/docs/exceptions.rst
@@ -1,6 +1,23 @@
 Exceptions
 ==========
 
+All of the exceptions raised from PyNaCl-exposed methods/functions
+are subclasses of :py:exc:`nacl.exceptions.CryptoError`. This means
+downstream users can just wrap cryptographic operations inside a
+
+.. code-block:: python
+
+    try:
+        # cryptographic operations
+    except nacl.exceptions.CryptoError:
+        # cleanup after any kind of exception
+        # raised from cryptographic-related operations
+
+These are the exceptions implemented in :py:mod:`nacl.exceptions`:
+
+PyNaCl specific exceptions
+--------------------------
+
 .. class:: CryptoError
 
     Base exception for all nacl related errors
@@ -9,3 +26,40 @@ Exceptions
 .. class:: BadSignatureError
 
     Raised when the signature was forged or otherwise corrupt.
+
+
+.. class:: InvalidkeyError
+
+    Raised on password/key verification mismatch
+
+
+PyNaCl exceptions mixing-in standard library ones
+-------------------------------------------------
+
+Both for clarity and for compatibility with previous releases
+of the PyNaCl, the following exceptions mix-in the same-named
+standard library exception to :py:class:`~nacl.exceptions.CryptoError`.
+
+.. class:: RuntimeError
+
+    is a subclass of both CryptoError and standard library's
+    RuntimeError, raised for internal library errors
+
+
+.. class:: AssertionError
+
+    is a subclass of both CryptoError and standard library's
+    AssertionError, raised by default from
+    :py:func:`~nacl.utils.ensure` when the checked condition is `False`
+
+
+.. class:: TypeError
+
+    is a subclass of both CryptoError and standard library's
+    TypeError
+
+
+.. class:: ValueError
+
+    is a subclass of both CryptoError and standard library's
+    ValueError
diff --git a/docs/hashing.rst b/docs/hashing.rst
new file mode 100644
index 0000000..0648652
--- /dev/null
+++ b/docs/hashing.rst
@@ -0,0 +1,170 @@
+Hashing
+=======
+
+.. currentmodule:: nacl.hash
+
+Cryptographic secure hash functions are irreversible transforms
+of input data to a fixed length `digest`.
+
+The standard properties of a cryptographic hash make these functions useful
+both for standalone usage as data integrity checkers, as well as ``black-box``
+building blocks of other kind of algorithms and data structures.
+
+All of the hash functions exposed in :py:mod:`nacl.hash` can be used
+as data integrity checkers.
+
+Integrity check examples
+------------------------
+
+Message's creator perspective (:py:func:`~nacl.hash.sha256`,
+                               :py:func:`~nacl.hash.sha512`,
+                               :py:func:`~nacl.hash.blake2b`)
+
+.. code-block:: python
+
+    import nacl.encoding
+    import nacl.hash
+
+    HASHER = nacl.hash.sha256
+    # could be nacl.hash.sha512 or nacl.hash.blake2b instead
+
+    # define a 1024 bytes log message
+    msg = 16*b'256 BytesMessage'
+    digest = nacl.hash.HASHER(msg, encoder=nacl.encoding.HexEncoder)
+
+    # now send msg and digest to the user
+    print(nacl.encoding.HexEncoder.encode(msg))
+    print(digest)
+
+
+Message's user perspective (:py:func:`~nacl.hash.sha256`,
+                            :py:func:`~nacl.hash.sha512`,
+                            :py:func:`~nacl.hash.blake2b`)
+
+.. code-block:: python
+
+    from nacl.bindings.utils import sodium_memcmp
+    import nacl.encoding
+    import nacl.hash
+
+    HASHER = nacl.hash.sha256
+    # could be nacl.hash.sha512 or nacl.hash.blake2b instead
+
+    # we received a 1024 bytes long message and it hex encoded digest
+    received_msg = nacl.encoding.HexEncoder.decode(
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    b'3235362042797465734d6573736167653235362042797465734d657373616765'
+    )
+
+    dgst = b'12b413c70c148d79bb57a1542156c5f35e24ad77c38e8c0e776d055e827cdd45'
+
+    shortened = received_msg[:-1]
+    modified = b'modified' + received_msg[:-8]
+
+    orig_dgs = HASHER(received_msg, encoder=nacl.encoding.HexEncoder)
+    shrt_dgs = HASHER(shortened, encoder=nacl.encoding.HexEncoder)
+    mdfd_dgs = HASHER(modified, encoder=nacl.encoding.HexEncoder)
+
+    def eq_chk(dgs0, dgs1):
+        if sodium_memcmp(dgs0, dgs1):
+            return 'equals'
+        return 'is different from'
+
+    MSG = 'Digest of {0} message {1} original digest'
+
+    for chk in (('original', orig_dgs),
+                ('truncated', shrt_dgs),
+                ('modified', mdfd_dgs)):
+
+        print(MSG.format(chk[0], eq_chk(dgst, chk[1])))
+
+
+Additional hashing usages for :class:`~nacl.hash.blake2b`
+---------------------------------------------------------
+
+As already hinted above, traditional cryptographic hash functions can be used
+as building blocks for other uses, typically combining a secret-key with
+the message via some construct like the ``HMAC`` one.
+
+The :class:`~nacl.hash.blake2b` hash function can be used directly both
+for message authentication and key derivation, replacing the ``HMAC`` construct
+and the ``HKDF`` one by setting the additional parameters ``key``, ``salt``
+and ``person``.
+
+Please note that **key stretching procedures** like ``HKDF`` or
+the one outlined in `Key derivation`_ are **not** suited to derive
+a *cryptographically-strong* key from a *low-entropy input* like a plain-text
+password or to compute a strong *long-term stored* hash used as password
+verifier. See the :ref:`password-hashing` section for some more informations
+and usage examples of the password hashing constructs provided in
+:py:mod:`~nacl.pwhash`.
+
+Message authentication
+----------------------
+
+To authenticate a message, using a secret key, the blake2b function
+must be called as in the following example.
+
+Message authentication example
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+    import nacl.encoding
+    from nacl.hash import blake2b
+
+    msg = 16*b'256 BytesMessage'
+    msg2 = 16*b'256 bytesMessage'
+
+    auth_key = nacl.utils.random(size=64)
+    # the simplest way to get a cryptographic quality auth_key
+    # is to generate it with a cryptographic quality
+    # random number generator
+
+    auth1_key = nacl.utils.random(size=64)
+    # generate a different key, just to show the mac is changed
+    # both with changing messages and with changing keys
+
+    mac0 = blake2b(msg, key=auth_key, encoder=nacl.encoding.HexEncoder)
+    mac1 = blake2b(msg, key=auth1_key, encoder=nacl.encoding.HexEncoder)
+    mac2 = blake2b(msg2, key=auth_key, encoder=nacl.encoding.HexEncoder)
+
+    for i, mac in enumerate((mac0, mac1, mac2)):
+        print('Mac{0} is: {1}.'.format(i, mac))
+
+
+Key derivation
+--------------
+
+The blake2b algorithm can replace a key derivation function by
+following the lines of:
+
+Key derivation example
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. code-block:: python
+
+    import nacl.encoding
+    import nacl.utils
+    from nacl.hash import blake2b
+
+    master_key = nacl.utils.random(64)
+
+    derivation_salt = nacl.utils.random(16)
+
+    personalization = b'<DK usage>'
+
+    derived = blake2b(b'', key=master_key, salt=derivation_salt,
+                      personal=personalization,
+                      encoding=nacl.encoding.RawEncoder)
+
+By repeating the key derivation procedure before encrypting our messages,
+and sending the derivation_salt along with the encrypted message, we can
+expect to never reuse a key, drastically reducing the risks which ensue from
+such a reuse.
diff --git a/docs/index.rst b/docs/index.rst
index e3830ef..e927e7f 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -10,6 +10,8 @@ Contents
    public
    secret
    signing
+   hashing
+   password_hashing
 
 
 Support Features
@@ -31,6 +33,21 @@ Api Documentation
     :glob:
 
     api/hash
+    api/hashlib
+
+Doing A Release
+===============
+
+To run a PyNaCl release follow these steps:
+
+* Update the version number in ``src/nacl/__init__.py``.
+* Update ``README.rst`` changelog section with the date of the release.
+* Send a pull request with these items and wait for it to be merged.
+* Run ``invoke release {version}``
+
+Once the release script completes you can verify that the sdist and wheels are
+present on PyPI and then send a new PR to bump the version to the next major
+version (e.g. ``1.2.0.dev1``).
 
 
 Indices and tables
diff --git a/docs/password_hashing.rst b/docs/password_hashing.rst
new file mode 100644
index 0000000..578696e
--- /dev/null
+++ b/docs/password_hashing.rst
@@ -0,0 +1,133 @@
+.. _password-hashing:
+
+Password hashing
+================
+
+.. currentmodule:: nacl.pwhash
+
+Password hashing and password based key derivation mechanisms in
+actual use are all based on the idea of iterating a hash function
+many times on a combination of the password and a random ``salt``,
+which is stored along with the hash, and allows verifying a proposed
+password while avoiding clear-text storage.
+
+The latest developments in password hashing have been *memory-hard*
+mechanisms, pioneered by the ``scrypt`` mechanism [SD2012]_, which
+is implemented by functions exposed in :py:mod:`nacl.pwhash`.
+
+
+Scrypt usage
+------------
+
+Password storage and verification
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The :py:func:`~nacl.pwhash.scryptsalsa208sha256_str` internally
+generates a random salt, and returns a scrypt hash already encoded
+in ascii modular crypt format, which can be stored in a shadow-like file::
+
+    >>> import nacl.pwhash
+    >>> password = b'my password'
+    >>> for i in range(4):
+    ...     print(nacl.pwhash.scryptsalsa208sha256_str(password))
+    ...
+    b'$7$C6..../....p9h...'
+    b'$7$C6..../....pVs...'
+    b'$7$C6..../....qW2...'
+    b'$7$C6..../....bxH...'
+
+
+To verify a user-proposed password, the
+:py:func:`~nacl.pwhash.scryptsalsa208sha256_verify` function
+extracts the used salt and scrypt memory and operation count parameters
+from the modular format string and checks the compliance of the
+proposed password with the stored hash::
+
+    >>> import nacl.pwhash
+    >>> hashed = (b'$7$C6..../....qv5tF9KG2WbuMeUOa0TCoqwLHQ8s0TjQdSagne'
+    ...           b'9NvU0$3d218uChMvdvN6EwSvKHMASkZIG51XPIsZQDcktKyN7'
+    ...           )
+    >>> correct = b'my password'
+    >>> wrong = b'My password'
+    >>> # the result will be True on password match
+    ... # on mismatch
+    ... res = nacl.pwhash.verify_scryptsalsa208sha256(hashed, correct)
+    >>> print(res)
+    True
+    >>>
+    >>> res2 = nacl.pwhash.verify_scryptsalsa208sha256(hashed, wrong)
+    Traceback (most recent call last):
+        ...
+    nacl.exceptions.InvalidkeyError: Wrong password
+    >>>
+
+
+Key derivation
+~~~~~~~~~~~~~~
+
+Alice needs to send a secret message to Bob, using a shared
+password to protect the content. She generates a random salt,
+combines it with the password using
+:py:func:`~nacl.pwhash.kdf_scryptsalsa208sha256` and sends
+the message along with the salt and key derivation parameters.
+
+.. code-block:: python
+
+    from nacl import pwhash, secret, utils
+
+    ops = pwhash.SCRYPT_OPSLIMIT_SENSITIVE
+    mem = pwhash.SCRYPT_MEMLIMIT_SENSITIVE
+
+    salt = utils.random(pwhash.SCRYPT_SALTBYTES)
+
+    password = b'password shared between Alice and Bob'
+    message = b"This is a message for Bob's eyes only"
+
+    Alices_key = pwhash.kdf_scryptsalsa208sha256(secret.SecretBox.KEY_SIZE,
+                                                 password, salt,
+                                                 opslimit=ops, memlimit=mem)
+    Alices_box = secret.SecretBox(Alices_key)
+    nonce = utils.random(secret.SecretBox.NONCE_SIZE)
+
+    encrypted = Alices_box.encrypt(message, nonce)
+
+    # now Alice must send to Bob both the encrypted message
+    # and the KDF parameters: salt, opslimit and memlimit;
+    # using the same parameters **and password**
+    # Bob is able to derive the correct key to decrypt the message
+
+
+    Bobs_key = pwhash.kdf_scryptsalsa208sha256(secret.SecretBox.KEY_SIZE,
+                                               password, salt,
+                                               opslimit=ops, memlimit=mem)
+    Bobs_box = secret.SecretBox(Bobs_key)
+    received = Bobs_box.decrypt(encrypted)
+    print(received)
+
+if Eve manages to get the encrypted message, and tries to decrypt it
+with a incorrect password, even if she does know all of the key
+derivation parameters, she would derive a different key. Therefore
+the decryption would fail and an exception would be raised::
+
+    >>> from nacl import pwhash, secret, utils
+    >>>
+    >>> ops = pwhash.SCRYPT_OPSLIMIT_SENSITIVE
+    >>> mem = pwhash.SCRYPT_MEMLIMIT_SENSITIVE
+    >>>
+    >>> salt = utils.random(pwhash.SCRYPT_SALTBYTES)
+    >>>
+    >>> guessed_pw = b'I think Alice shared this password with Bob'
+    >>>
+    >>> Eves_key = pwhash.kdf_scryptsalsa208sha256(secret.SecretBox.KEY_SIZE,
+    ...                                            guessed_pw, salt,
+    ...                                            opslimit=ops, memlimit=mem)
+    >>> Eves_box = secret.SecretBox(Eves_key)
+    >>> intercepted = Eves_box.decrypt(encrypted)
+    Traceback (most recent call last):
+        ...
+    nacl.exceptions.CryptoError: Decryption failed. Ciphertext failed ...
+
+.. [SD2012] A nice overview of password hashing history is available
+   in Solar Designer's presentation
+   `Password security: past, present, future
+   <http://www.openwall.com/presentations/Passwords12-The-Future-Of-Hashing/>`_
diff --git a/docs/public.rst b/docs/public.rst
index bbaa588..55c97ae 100644
--- a/docs/public.rst
+++ b/docs/public.rst
@@ -46,35 +46,51 @@ This is how the system works:
     import nacl.utils
     from nacl.public import PrivateKey, Box
 
-    # generate the private key which must be kept secret
+    # Generate Bob's private key, which must be kept secret
     skbob = PrivateKey.generate()
 
-    # the public key can be given to anyone wishing to send
-    # Bob an encrypted message
+    # Bob's public key can be given to anyone wishing to send
... 50292 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-nacl.git



More information about the Python-modules-commits mailing list