New Upstream Snapshot - pysodium
Ready changes
Summary
Merged new upstream version: 0.7.12 (was: 0.7.0).
Resulting package
Built on 2022-10-21T00:30 (took 2m23s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots python3-pysodium
Lintian Result
Diff
diff --git a/AUTHORS b/AUTHORS
index 00b273c..cde6e86 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,3 +15,5 @@ iachievedit
Tacitus Aedifex
venzen
Blaz Bregar
+berndb84
+Chris Topher c@creemama.com
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..a4b666b
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,25 @@
+Wrapper for libsodium library
+
+Copyright (c) 2013-2014, Marsiske Stefan.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
index 9a42db3..d635bbd 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,3 @@
-include README.md
include AUTHORS
+include LICENSE.txt
+include README.md
diff --git a/PKG-INFO b/PKG-INFO
index 2cc0fc1..c89f3b5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,216 +1,252 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: pysodium
-Version: 0.7.0-0
+Version: 0.7.12
Summary: python libsodium wrapper
Home-page: https://github.com/stef/pysodium
Author: Stefan Marsiske
Author-email: s@ctrlc.hu
License: BSD
-Description: This is a very simple wrapper around libsodium masquerading as nacl.
-
- [![Build Status](https://travis-ci.org/stef/pysodium.svg?branch=master)](https://travis-ci.org/stef/pysodium)
-
- This wrapper requires a pre-installed libsodium from:
-
- https://github.com/jedisct1/libsodium
-
- then it provides access to the following functions:
-
- ```
- crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key)
- crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key)
- crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
- crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key)
- crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key)
- crypto_auth(message, key)
- crypto_auth_verify(tag, message, key)
- crypto_box_afternm(msg, nonce, k)
- crypto_box_beforenm(pk, sk)
- crypto_box_detached(msg, nonce, pk, sk)
- crypto_box_keypair()
- crypto_box(msg, nonce, pk, sk)
- crypto_box_open_afternm(c, nonce, k)
- crypto_box_open(c, nonce, pk, sk)
- crypto_box_open_detached(c, mac, nonce, pk, sk)
- crypto_box_seal(msg, pk)
- crypto_box_seal_open(c, pk, sk)
- crypto_box_seed_keypair(seed)
- crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b'')
- crypto_generichash_final(state, outlen=crypto_generichash_BYTES)
- crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b'')
- crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES)
- crypto_generichash_update(state, m)
- crypto_hash_sha256(message)
- crypto_hash_sha512(message)
- crypto_kx_client_session_keys(client_pk, client_sk, server_pk)
- crypto_kx_keypair()
- crypto_kx_server_session_keys(server_pk, server_sk, client_pk)
- crypto_pwhash(outlen, passwd, salt, opslimit, memlimit, alg)
- crypto_pwhash_scryptsalsa208sha256(outlen, passwd, salt, opslimit, memlimit)
- crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit)
- crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd)
- crypto_pwhash_str(passwd, opslimit, memlimit)
- crypto_pwhash_str_verify(pstr, passwd)
- crypto_scalarmult_curve25519_base(n)
- crypto_scalarmult_curve25519(n, p)
- crypto_secretbox(msg, nonce, k)
- crypto_secretbox_open(c, nonce, k)
- crypto_secretstream_xchacha20poly1305_keygen():
- crypto_secretstream_xchacha20poly1305_init_push(key):
- crypto_secretstream_xchacha20poly1305_init_pull(header, key):
- crypto_secretstream_xchacha20poly1305_rekey(state):
- crypto_secretstream_xchacha20poly1305_push(state, message, ad, tag):
- crypto_secretstream_xchacha20poly1305_pull(state, ciphertext, ad):
- crypto_sign_init()
- crypto_sign_update(state, m)
- crypto_sign_final_create(state, sk)
- crypto_sign_final_verify(state, sig, pk)
- crypto_sign_detached(m, sk)
- crypto_sign_keypair()
- crypto_sign(m, sk)
- crypto_sign_open(sm, pk)
- crypto_sign_pk_to_box_pk(pk)
- crypto_sign_seed_keypair(seed)
- crypto_sign_sk_to_box_sk(sk)
- crypto_sign_sk_to_pk(sk)
- crypto_sign_sk_to_seed(sk)
- crypto_sign_verify_detached(sig, msg, pk)
- crypto_stream_chacha20_xor(message, nonce, key)
- crypto_stream(cnt, nonce=None, key=None)
- crypto_stream_xor(msg, cnt, nonce=None, key=None)
- randombytes(size)
- ```
-
- Constants:
-
- ```
- crypto_aead_chacha20poly1305_ABYTES
- crypto_aead_chacha20poly1305_KEYBYTES
- crypto_aead_chacha20poly1305_NPUBBYTES
- crypto_aead_chacha20poly1305_ietf_KEYBYTES
- crypto_aead_chacha20poly1305_ietf_NPUBBYTES
- crypto_aead_xchacha20poly1305_ietf_KEYBYTES
- crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
- crypto_aead_xchacha20poly1305_ietf_ABYTES
- crypto_auth_BYTES
- crypto_auth_KEYBYTES
- crypto_box_BEFORENMBYTES
- crypto_box_BOXZEROBYTES
- crypto_box_MACBYTES
- crypto_box_NONCEBYTES
- crypto_box_PUBLICKEYBYTES
- crypto_box_SEALBYTES
- crypto_box_SECRETKEYBYTES
- crypto_box_SEEDBYTES
- crypto_box_ZEROBYTES
- crypto_generichash_KEYBYTES_MAX
- crypto_generichash_BYTES
- crypto_generichash_BYTES_MAX
- crypto_generichash_BYTES_MIN
- crypto_generichash_STATEBYTES
- crypto_generichash_blake2b_BYTES
- crypto_generichash_blake2b_BYTES_MAX
- crypto_generichash_blake2b_BYTES_MIN
- crypto_generichash_blake2b_KEYBYTES_MAX
- crypto_generichash_blake2b_PERSONALBYTES
- crypto_generichash_blake2b_SALTBYTES
- crypto_hash_sha256_BYTES
- crypto_hash_sha512_BYTES
- crypto_kx_PUBLICKEYBYTES
- crypto_kx_SECRETKEYBYTES
- crypto_kx_SESSIONKEYBYTES
- crypto_pwhash_ALG_DEFAULT
- crypto_pwhash_ALG_ARGON2I13
- crypto_pwhash_ALG_ARGON2ID13
- crypto_pwhash_BYTES_MAX
- crypto_pwhash_BYTES_MIN
- crypto_pwhash_MEMLIMIT_MAX
- crypto_pwhash_MEMLIMIT_MIN
- crypto_pwhash_MEMLIMIT_INTERACTIVE
- crypto_pwhash_MEMLIMIT_MODERATE
- crypto_pwhash_MEMLIMIT_SENSITIVE
- crypto_pwhash_OPSLIMIT_MAX
- crypto_pwhash_OPSLIMIT_MIN
- crypto_pwhash_OPSLIMIT_INTERACTIVE
- crypto_pwhash_OPSLIMIT_MODERATE
- crypto_pwhash_OPSLIMIT_SENSITIVE
- crypto_pwhash_PASSWD_MAX
- crypto_pwhash_PASSWD_MIN
- crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
- crypto_pwhash_argon2i_MEMLIMIT_MODERATE
- crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
- crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
- crypto_pwhash_argon2i_OPSLIMIT_MODERATE
- crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
- crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
- crypto_pwhash_argon2id_MEMLIMIT_MODERATE
- crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
- crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
- crypto_pwhash_argon2id_OPSLIMIT_MODERATE
- crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
- crypto_pwhash_SALTBYTES
- crypto_pwhash_STRBYTES
- crypto_pwhash_scryptsalsa208sha256_BYTES_MAX
- crypto_pwhash_scryptsalsa208sha256_BYTES_MIN
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
- crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX
- crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN
- crypto_pwhash_scryptsalsa208sha256_SALTBYTES
- crypto_pwhash_scryptsalsa208sha256_STRBYTES
- crypto_pwhash_scryptsalsa208sha256_STRPREFIX
- crypto_scalarmult_BYTES
- crypto_scalarmult_SCALARBYTES
- crypto_scalarmult_curve25519_BYTES
- crypto_secretbox_BOXZEROBYTES
- crypto_secretbox_KEYBYTES
- crypto_secretbox_KEYBYTES
- crypto_secretbox_MACBYTES
- crypto_secretbox_NONCEBYTES
- crypto_secretbox_ZEROBYTES
- crypto_secretstream_xchacha20poly1305_STATEBYTES
- crypto_secretstream_xchacha20poly1305_ABYTES
- crypto_secretstream_xchacha20poly1305_HEADERBYTES
- crypto_secretstream_xchacha20poly1305_KEYBYTES
- crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
- crypto_secretstream_xchacha20poly1305_TAG_MESSAGE
- crypto_secretstream_xchacha20poly1305_TAG_PUSH
- crypto_secretstream_xchacha20poly1305_TAG_REKEY
- crypto_secretstream_xchacha20poly1305_TAG_FINAL
- crypto_sign_BYTES
- crypto_sign_PUBLICKEYBYTES
- crypto_sign_SECRETKEYBYTES
- crypto_sign_SEEDBYTES
- crypto_sign_ed25519_PUBLICKEYBYTES
- crypto_sign_ed25519_SECRETKEYBYTES
- crypto_stream_KEYBYTES
- crypto_stream_NONCEBYTES
- crypto_stream_chacha20_NONCEBYTES
- crypto_stream_chacha20_KEYBYTES
- ```
-
-
-
- Note
-
- most of the the `*_easy` functions are not implemented as the "non-easy"
- functions provide already the "easy" interface, which hides the placement of
- buffers in memory, which makes little sense in python, so this wrapper handles
- this.
-
Keywords: cryptography API NaCl libsodium
-Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Security
Requires: libsodium
+License-File: LICENSE.txt
+License-File: AUTHORS
+
+This is a very simple wrapper around libsodium masquerading as nacl.
+
+[![Build Status](https://travis-ci.org/stef/pysodium.svg?branch=master)](https://travis-ci.org/stef/pysodium)
+
+This wrapper requires a pre-installed libsodium from:
+
+ https://github.com/jedisct1/libsodium
+
+then it provides access to the following functions:
+
+```
+crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key)
+crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_decrypt_detached(ciphertext, mac, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_encrypt_detached(message, ad, nonce, key)
+crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key)
+crypto_auth(message, key)
+crypto_auth_verify(tag, message, key)
+crypto_box_afternm(msg, nonce, k)
+crypto_box_beforenm(pk, sk)
+crypto_box_detached(msg, nonce, pk, sk)
+crypto_box_keypair()
+crypto_box(msg, nonce, pk, sk)
+crypto_box_open_afternm(c, nonce, k)
+crypto_box_open(c, nonce, pk, sk)
+crypto_box_open_detached(c, mac, nonce, pk, sk)
+crypto_box_seal(msg, pk)
+crypto_box_seal_open(c, pk, sk)
+crypto_box_seed_keypair(seed)
+crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b'')
+crypto_generichash_final(state, outlen=crypto_generichash_BYTES)
+crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b'')
+crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES)
+crypto_generichash_update(state, m)
+crypto_hash_sha256(message)
+crypto_hash_sha512(message)
+crypto_hash_sha512_init()
+crypto_hash_sha512_update(state, data)
+crypto_hash_sha512_final(state)
+crypto_kx_client_session_keys(client_pk, client_sk, server_pk)
+crypto_kx_keypair()
+crypto_kx_server_session_keys(server_pk, server_sk, client_pk)
+crypto_pwhash(outlen, passwd, salt, opslimit, memlimit, alg)
+crypto_pwhash_scryptsalsa208sha256(outlen, passwd, salt, opslimit, memlimit)
+crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit)
+crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd)
+crypto_pwhash_str(passwd, opslimit, memlimit)
+crypto_pwhash_str_verify(pstr, passwd)
+crypto_scalarmult_base(n)
+crypto_scalarmult_curve25519_base(n)
+crypto_scalarmult_curve25519(n, p)
+crypto_secretbox(msg, nonce, k)
+crypto_secretbox_detached(msg, nonce, k)
+crypto_secretbox_open(c, nonce, k)
+crypto_secretbox_open_detached(c, mac, nonce, k)
+crypto_secretstream_xchacha20poly1305_keygen():
+crypto_secretstream_xchacha20poly1305_init_push(key):
+crypto_secretstream_xchacha20poly1305_init_pull(header, key):
+crypto_secretstream_xchacha20poly1305_rekey(state):
+crypto_secretstream_xchacha20poly1305_push(state, message, ad, tag):
+crypto_secretstream_xchacha20poly1305_pull(state, ciphertext, ad):
+crypto_sign_init()
+crypto_sign_update(state, m)
+crypto_sign_final_create(state, sk)
+crypto_sign_final_verify(state, sig, pk)
+crypto_sign_detached(m, sk)
+crypto_sign_keypair()
+crypto_sign(m, sk)
+crypto_sign_open(sm, pk)
+crypto_sign_pk_to_box_pk(pk)
+crypto_sign_seed_keypair(seed)
+crypto_sign_sk_to_box_sk(sk)
+crypto_sign_sk_to_pk(sk)
+crypto_sign_sk_to_seed(sk)
+crypto_sign_verify_detached(sig, msg, pk)
+crypto_stream_chacha20_xor(message, nonce, key)
+crypto_stream_chacha20_xor_ic(message, nonce, initial_counter, key)
+crypto_stream_xchacha20_xor(message, nonce, key)
+crypto_stream_xchacha20_xor_ic(message, nonce, initial_counter, key)
+crypto_stream(cnt, nonce=None, key=None)
+crypto_stream_xor(msg, cnt, nonce=None, key=None)
+randombytes(size)
+sodium_increment(bytes)
+crypto_core_ristretto255_is_valid_point(p)
+crypto_core_ristretto255_from_hash(r)
+crypto_scalarmult_ristretto255(n, p)
+crypto_scalarmult_ristretto255_base(n)
+crypto_core_ristretto255_scalar_random()
+crypto_core_ristretto255_scalar_invert(s)
+crypto_core_ristretto255_scalar_reduce(s)
+crypto_core_ristretto255_add(p, q)
+crypto_core_ristretto255_sub(p,q)
+crypto_core_ristretto255_random()
+crypto_core_ristretto255_scalar_negate(s)
+crypto_core_ristretto255_scalar_complement(s)
+crypto_core_ristretto255_scalar_add(x,y)
+crypto_core_ristretto255_scalar_sub(x,y)
+crypto_core_ristretto255_scalar_mul(x,y)
+```
+
+Constants:
+
+```
+crypto_aead_chacha20poly1305_ABYTES
+crypto_aead_chacha20poly1305_KEYBYTES
+crypto_aead_chacha20poly1305_NPUBBYTES
+crypto_aead_chacha20poly1305_ietf_KEYBYTES
+crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+crypto_aead_chacha20poly1305_ietf_ABYTES
+crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+crypto_aead_xchacha20poly1305_ietf_ABYTES
+crypto_auth_BYTES
+crypto_auth_KEYBYTES
+crypto_box_BEFORENMBYTES
+crypto_box_BOXZEROBYTES
+crypto_box_MACBYTES
+crypto_box_NONCEBYTES
+crypto_box_PUBLICKEYBYTES
+crypto_box_SEALBYTES
+crypto_box_SECRETKEYBYTES
+crypto_box_SEEDBYTES
+crypto_box_ZEROBYTES
+crypto_generichash_KEYBYTES_MAX
+crypto_generichash_BYTES
+crypto_generichash_BYTES_MAX
+crypto_generichash_BYTES_MIN
+crypto_generichash_STATEBYTES
+crypto_generichash_blake2b_BYTES
+crypto_generichash_blake2b_BYTES_MAX
+crypto_generichash_blake2b_BYTES_MIN
+crypto_generichash_blake2b_KEYBYTES_MAX
+crypto_generichash_blake2b_PERSONALBYTES
+crypto_generichash_blake2b_SALTBYTES
+crypto_hash_sha256_BYTES
+crypto_hash_sha512_BYTES
+crypto_hash_sha512_STATEBYTES
+crypto_kx_PUBLICKEYBYTES
+crypto_kx_SECRETKEYBYTES
+crypto_kx_SESSIONKEYBYTES
+crypto_pwhash_ALG_DEFAULT
+crypto_pwhash_ALG_ARGON2I13
+crypto_pwhash_ALG_ARGON2ID13
+crypto_pwhash_BYTES_MAX
+crypto_pwhash_BYTES_MIN
+crypto_pwhash_MEMLIMIT_MAX
+crypto_pwhash_MEMLIMIT_MIN
+crypto_pwhash_MEMLIMIT_INTERACTIVE
+crypto_pwhash_MEMLIMIT_MODERATE
+crypto_pwhash_MEMLIMIT_SENSITIVE
+crypto_pwhash_OPSLIMIT_MAX
+crypto_pwhash_OPSLIMIT_MIN
+crypto_pwhash_OPSLIMIT_INTERACTIVE
+crypto_pwhash_OPSLIMIT_MODERATE
+crypto_pwhash_OPSLIMIT_SENSITIVE
+crypto_pwhash_PASSWD_MAX
+crypto_pwhash_PASSWD_MIN
+crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
+crypto_pwhash_argon2i_MEMLIMIT_MODERATE
+crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
+crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
+crypto_pwhash_argon2i_OPSLIMIT_MODERATE
+crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
+crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
+crypto_pwhash_argon2id_MEMLIMIT_MODERATE
+crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
+crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
+crypto_pwhash_argon2id_OPSLIMIT_MODERATE
+crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
+crypto_pwhash_SALTBYTES
+crypto_pwhash_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_BYTES_MAX
+crypto_pwhash_scryptsalsa208sha256_BYTES_MIN
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN
+crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+crypto_pwhash_scryptsalsa208sha256_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+crypto_scalarmult_BYTES
+crypto_scalarmult_SCALARBYTES
+crypto_scalarmult_curve25519_BYTES
+crypto_secretbox_BOXZEROBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_MACBYTES
+crypto_secretbox_NONCEBYTES
+crypto_secretbox_ZEROBYTES
+crypto_secretstream_xchacha20poly1305_STATEBYTES
+crypto_secretstream_xchacha20poly1305_ABYTES
+crypto_secretstream_xchacha20poly1305_HEADERBYTES
+crypto_secretstream_xchacha20poly1305_KEYBYTES
+crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
+crypto_secretstream_xchacha20poly1305_TAG_MESSAGE
+crypto_secretstream_xchacha20poly1305_TAG_PUSH
+crypto_secretstream_xchacha20poly1305_TAG_REKEY
+crypto_secretstream_xchacha20poly1305_TAG_FINAL
+crypto_sign_BYTES
+crypto_sign_PUBLICKEYBYTES
+crypto_sign_SECRETKEYBYTES
+crypto_sign_SEEDBYTES
+crypto_sign_ed25519_PUBLICKEYBYTES
+crypto_sign_ed25519_SECRETKEYBYTES
+crypto_stream_KEYBYTES
+crypto_stream_NONCEBYTES
+crypto_stream_chacha20_NONCEBYTES
+crypto_stream_chacha20_KEYBYTES
+crypto_stream_xchacha20_NONCEBYTES
+crypto_stream_xchacha20_KEYBYTES
+crypto_core_ristretto255_BYTES
+crypto_core_ristretto255_HASHBYTES
+crypto_core_ristretto255_SCALARBYTES
+crypto_core_ristretto255_NONREDUCEDSCALARBYTES
+```
+
+
+
+Note
+
+most of the the `*_easy` functions are not implemented as the "non-easy"
+functions provide already the "easy" interface, which hides the placement of
+buffers in memory, which makes little sense in python, so this wrapper handles
+this.
diff --git a/README.md b/README.md
index eb1eec2..684b920 100644
--- a/README.md
+++ b/README.md
@@ -10,11 +10,13 @@ then it provides access to the following functions:
```
crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key)
crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key)
-crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_decrypt_detached(ciphertext, mac, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_encrypt_detached(message, ad, nonce, key)
crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key)
crypto_auth(message, key)
@@ -37,6 +39,9 @@ crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES)
crypto_generichash_update(state, m)
crypto_hash_sha256(message)
crypto_hash_sha512(message)
+crypto_hash_sha512_init()
+crypto_hash_sha512_update(state, data)
+crypto_hash_sha512_final(state)
crypto_kx_client_session_keys(client_pk, client_sk, server_pk)
crypto_kx_keypair()
crypto_kx_server_session_keys(server_pk, server_sk, client_pk)
@@ -46,10 +51,13 @@ crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit)
crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd)
crypto_pwhash_str(passwd, opslimit, memlimit)
crypto_pwhash_str_verify(pstr, passwd)
+crypto_scalarmult_base(n)
crypto_scalarmult_curve25519_base(n)
crypto_scalarmult_curve25519(n, p)
crypto_secretbox(msg, nonce, k)
+crypto_secretbox_detached(msg, nonce, k)
crypto_secretbox_open(c, nonce, k)
+crypto_secretbox_open_detached(c, mac, nonce, k)
crypto_secretstream_xchacha20poly1305_keygen():
crypto_secretstream_xchacha20poly1305_init_push(key):
crypto_secretstream_xchacha20poly1305_init_pull(header, key):
@@ -71,9 +79,28 @@ crypto_sign_sk_to_pk(sk)
crypto_sign_sk_to_seed(sk)
crypto_sign_verify_detached(sig, msg, pk)
crypto_stream_chacha20_xor(message, nonce, key)
+crypto_stream_chacha20_xor_ic(message, nonce, initial_counter, key)
+crypto_stream_xchacha20_xor(message, nonce, key)
+crypto_stream_xchacha20_xor_ic(message, nonce, initial_counter, key)
crypto_stream(cnt, nonce=None, key=None)
crypto_stream_xor(msg, cnt, nonce=None, key=None)
randombytes(size)
+sodium_increment(bytes)
+crypto_core_ristretto255_is_valid_point(p)
+crypto_core_ristretto255_from_hash(r)
+crypto_scalarmult_ristretto255(n, p)
+crypto_scalarmult_ristretto255_base(n)
+crypto_core_ristretto255_scalar_random()
+crypto_core_ristretto255_scalar_invert(s)
+crypto_core_ristretto255_scalar_reduce(s)
+crypto_core_ristretto255_add(p, q)
+crypto_core_ristretto255_sub(p,q)
+crypto_core_ristretto255_random()
+crypto_core_ristretto255_scalar_negate(s)
+crypto_core_ristretto255_scalar_complement(s)
+crypto_core_ristretto255_scalar_add(x,y)
+crypto_core_ristretto255_scalar_sub(x,y)
+crypto_core_ristretto255_scalar_mul(x,y)
```
Constants:
@@ -84,6 +111,7 @@ crypto_aead_chacha20poly1305_KEYBYTES
crypto_aead_chacha20poly1305_NPUBBYTES
crypto_aead_chacha20poly1305_ietf_KEYBYTES
crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+crypto_aead_chacha20poly1305_ietf_ABYTES
crypto_aead_xchacha20poly1305_ietf_KEYBYTES
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
crypto_aead_xchacha20poly1305_ietf_ABYTES
@@ -111,6 +139,7 @@ crypto_generichash_blake2b_PERSONALBYTES
crypto_generichash_blake2b_SALTBYTES
crypto_hash_sha256_BYTES
crypto_hash_sha512_BYTES
+crypto_hash_sha512_STATEBYTES
crypto_kx_PUBLICKEYBYTES
crypto_kx_SECRETKEYBYTES
crypto_kx_SESSIONKEYBYTES
@@ -188,6 +217,12 @@ crypto_stream_KEYBYTES
crypto_stream_NONCEBYTES
crypto_stream_chacha20_NONCEBYTES
crypto_stream_chacha20_KEYBYTES
+crypto_stream_xchacha20_NONCEBYTES
+crypto_stream_xchacha20_KEYBYTES
+crypto_core_ristretto255_BYTES
+crypto_core_ristretto255_HASHBYTES
+crypto_core_ristretto255_SCALARBYTES
+crypto_core_ristretto255_NONREDUCEDSCALARBYTES
```
diff --git a/debian/changelog b/debian/changelog
index ba1c82a..9949c71 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pysodium (0.7.12-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Fri, 21 Oct 2022 00:28:35 -0000
+
pysodium (0.7.0-3) unstable; urgency=medium
[ Debian Janitor ]
diff --git a/pysodium.egg-info/PKG-INFO b/pysodium.egg-info/PKG-INFO
index 2cc0fc1..c89f3b5 100644
--- a/pysodium.egg-info/PKG-INFO
+++ b/pysodium.egg-info/PKG-INFO
@@ -1,216 +1,252 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: pysodium
-Version: 0.7.0-0
+Version: 0.7.12
Summary: python libsodium wrapper
Home-page: https://github.com/stef/pysodium
Author: Stefan Marsiske
Author-email: s@ctrlc.hu
License: BSD
-Description: This is a very simple wrapper around libsodium masquerading as nacl.
-
- [![Build Status](https://travis-ci.org/stef/pysodium.svg?branch=master)](https://travis-ci.org/stef/pysodium)
-
- This wrapper requires a pre-installed libsodium from:
-
- https://github.com/jedisct1/libsodium
-
- then it provides access to the following functions:
-
- ```
- crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key)
- crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key)
- crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
- crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key)
- crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
- crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key)
- crypto_auth(message, key)
- crypto_auth_verify(tag, message, key)
- crypto_box_afternm(msg, nonce, k)
- crypto_box_beforenm(pk, sk)
- crypto_box_detached(msg, nonce, pk, sk)
- crypto_box_keypair()
- crypto_box(msg, nonce, pk, sk)
- crypto_box_open_afternm(c, nonce, k)
- crypto_box_open(c, nonce, pk, sk)
- crypto_box_open_detached(c, mac, nonce, pk, sk)
- crypto_box_seal(msg, pk)
- crypto_box_seal_open(c, pk, sk)
- crypto_box_seed_keypair(seed)
- crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b'')
- crypto_generichash_final(state, outlen=crypto_generichash_BYTES)
- crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b'')
- crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES)
- crypto_generichash_update(state, m)
- crypto_hash_sha256(message)
- crypto_hash_sha512(message)
- crypto_kx_client_session_keys(client_pk, client_sk, server_pk)
- crypto_kx_keypair()
- crypto_kx_server_session_keys(server_pk, server_sk, client_pk)
- crypto_pwhash(outlen, passwd, salt, opslimit, memlimit, alg)
- crypto_pwhash_scryptsalsa208sha256(outlen, passwd, salt, opslimit, memlimit)
- crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit)
- crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd)
- crypto_pwhash_str(passwd, opslimit, memlimit)
- crypto_pwhash_str_verify(pstr, passwd)
- crypto_scalarmult_curve25519_base(n)
- crypto_scalarmult_curve25519(n, p)
- crypto_secretbox(msg, nonce, k)
- crypto_secretbox_open(c, nonce, k)
- crypto_secretstream_xchacha20poly1305_keygen():
- crypto_secretstream_xchacha20poly1305_init_push(key):
- crypto_secretstream_xchacha20poly1305_init_pull(header, key):
- crypto_secretstream_xchacha20poly1305_rekey(state):
- crypto_secretstream_xchacha20poly1305_push(state, message, ad, tag):
- crypto_secretstream_xchacha20poly1305_pull(state, ciphertext, ad):
- crypto_sign_init()
- crypto_sign_update(state, m)
- crypto_sign_final_create(state, sk)
- crypto_sign_final_verify(state, sig, pk)
- crypto_sign_detached(m, sk)
- crypto_sign_keypair()
- crypto_sign(m, sk)
- crypto_sign_open(sm, pk)
- crypto_sign_pk_to_box_pk(pk)
- crypto_sign_seed_keypair(seed)
- crypto_sign_sk_to_box_sk(sk)
- crypto_sign_sk_to_pk(sk)
- crypto_sign_sk_to_seed(sk)
- crypto_sign_verify_detached(sig, msg, pk)
- crypto_stream_chacha20_xor(message, nonce, key)
- crypto_stream(cnt, nonce=None, key=None)
- crypto_stream_xor(msg, cnt, nonce=None, key=None)
- randombytes(size)
- ```
-
- Constants:
-
- ```
- crypto_aead_chacha20poly1305_ABYTES
- crypto_aead_chacha20poly1305_KEYBYTES
- crypto_aead_chacha20poly1305_NPUBBYTES
- crypto_aead_chacha20poly1305_ietf_KEYBYTES
- crypto_aead_chacha20poly1305_ietf_NPUBBYTES
- crypto_aead_xchacha20poly1305_ietf_KEYBYTES
- crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
- crypto_aead_xchacha20poly1305_ietf_ABYTES
- crypto_auth_BYTES
- crypto_auth_KEYBYTES
- crypto_box_BEFORENMBYTES
- crypto_box_BOXZEROBYTES
- crypto_box_MACBYTES
- crypto_box_NONCEBYTES
- crypto_box_PUBLICKEYBYTES
- crypto_box_SEALBYTES
- crypto_box_SECRETKEYBYTES
- crypto_box_SEEDBYTES
- crypto_box_ZEROBYTES
- crypto_generichash_KEYBYTES_MAX
- crypto_generichash_BYTES
- crypto_generichash_BYTES_MAX
- crypto_generichash_BYTES_MIN
- crypto_generichash_STATEBYTES
- crypto_generichash_blake2b_BYTES
- crypto_generichash_blake2b_BYTES_MAX
- crypto_generichash_blake2b_BYTES_MIN
- crypto_generichash_blake2b_KEYBYTES_MAX
- crypto_generichash_blake2b_PERSONALBYTES
- crypto_generichash_blake2b_SALTBYTES
- crypto_hash_sha256_BYTES
- crypto_hash_sha512_BYTES
- crypto_kx_PUBLICKEYBYTES
- crypto_kx_SECRETKEYBYTES
- crypto_kx_SESSIONKEYBYTES
- crypto_pwhash_ALG_DEFAULT
- crypto_pwhash_ALG_ARGON2I13
- crypto_pwhash_ALG_ARGON2ID13
- crypto_pwhash_BYTES_MAX
- crypto_pwhash_BYTES_MIN
- crypto_pwhash_MEMLIMIT_MAX
- crypto_pwhash_MEMLIMIT_MIN
- crypto_pwhash_MEMLIMIT_INTERACTIVE
- crypto_pwhash_MEMLIMIT_MODERATE
- crypto_pwhash_MEMLIMIT_SENSITIVE
- crypto_pwhash_OPSLIMIT_MAX
- crypto_pwhash_OPSLIMIT_MIN
- crypto_pwhash_OPSLIMIT_INTERACTIVE
- crypto_pwhash_OPSLIMIT_MODERATE
- crypto_pwhash_OPSLIMIT_SENSITIVE
- crypto_pwhash_PASSWD_MAX
- crypto_pwhash_PASSWD_MIN
- crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
- crypto_pwhash_argon2i_MEMLIMIT_MODERATE
- crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
- crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
- crypto_pwhash_argon2i_OPSLIMIT_MODERATE
- crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
- crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
- crypto_pwhash_argon2id_MEMLIMIT_MODERATE
- crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
- crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
- crypto_pwhash_argon2id_OPSLIMIT_MODERATE
- crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
- crypto_pwhash_SALTBYTES
- crypto_pwhash_STRBYTES
- crypto_pwhash_scryptsalsa208sha256_BYTES_MAX
- crypto_pwhash_scryptsalsa208sha256_BYTES_MIN
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
- crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
- crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
- crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX
- crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN
- crypto_pwhash_scryptsalsa208sha256_SALTBYTES
- crypto_pwhash_scryptsalsa208sha256_STRBYTES
- crypto_pwhash_scryptsalsa208sha256_STRPREFIX
- crypto_scalarmult_BYTES
- crypto_scalarmult_SCALARBYTES
- crypto_scalarmult_curve25519_BYTES
- crypto_secretbox_BOXZEROBYTES
- crypto_secretbox_KEYBYTES
- crypto_secretbox_KEYBYTES
- crypto_secretbox_MACBYTES
- crypto_secretbox_NONCEBYTES
- crypto_secretbox_ZEROBYTES
- crypto_secretstream_xchacha20poly1305_STATEBYTES
- crypto_secretstream_xchacha20poly1305_ABYTES
- crypto_secretstream_xchacha20poly1305_HEADERBYTES
- crypto_secretstream_xchacha20poly1305_KEYBYTES
- crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
- crypto_secretstream_xchacha20poly1305_TAG_MESSAGE
- crypto_secretstream_xchacha20poly1305_TAG_PUSH
- crypto_secretstream_xchacha20poly1305_TAG_REKEY
- crypto_secretstream_xchacha20poly1305_TAG_FINAL
- crypto_sign_BYTES
- crypto_sign_PUBLICKEYBYTES
- crypto_sign_SECRETKEYBYTES
- crypto_sign_SEEDBYTES
- crypto_sign_ed25519_PUBLICKEYBYTES
- crypto_sign_ed25519_SECRETKEYBYTES
- crypto_stream_KEYBYTES
- crypto_stream_NONCEBYTES
- crypto_stream_chacha20_NONCEBYTES
- crypto_stream_chacha20_KEYBYTES
- ```
-
-
-
- Note
-
- most of the the `*_easy` functions are not implemented as the "non-easy"
- functions provide already the "easy" interface, which hides the placement of
- buffers in memory, which makes little sense in python, so this wrapper handles
- this.
-
Keywords: cryptography API NaCl libsodium
-Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Security
Requires: libsodium
+License-File: LICENSE.txt
+License-File: AUTHORS
+
+This is a very simple wrapper around libsodium masquerading as nacl.
+
+[![Build Status](https://travis-ci.org/stef/pysodium.svg?branch=master)](https://travis-ci.org/stef/pysodium)
+
+This wrapper requires a pre-installed libsodium from:
+
+ https://github.com/jedisct1/libsodium
+
+then it provides access to the following functions:
+
+```
+crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key)
+crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_decrypt_detached(ciphertext, mac, ad, nonce, key)
+crypto_aead_chacha20poly1305_ietf_encrypt_detached(message, ad, nonce, key)
+crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key)
+crypto_aead_xchacha20poly1305_ietf_encrypt(message, ad, nonce, key)
+crypto_auth(message, key)
+crypto_auth_verify(tag, message, key)
+crypto_box_afternm(msg, nonce, k)
+crypto_box_beforenm(pk, sk)
+crypto_box_detached(msg, nonce, pk, sk)
+crypto_box_keypair()
+crypto_box(msg, nonce, pk, sk)
+crypto_box_open_afternm(c, nonce, k)
+crypto_box_open(c, nonce, pk, sk)
+crypto_box_open_detached(c, mac, nonce, pk, sk)
+crypto_box_seal(msg, pk)
+crypto_box_seal_open(c, pk, sk)
+crypto_box_seed_keypair(seed)
+crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b'')
+crypto_generichash_final(state, outlen=crypto_generichash_BYTES)
+crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b'')
+crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES)
+crypto_generichash_update(state, m)
+crypto_hash_sha256(message)
+crypto_hash_sha512(message)
+crypto_hash_sha512_init()
+crypto_hash_sha512_update(state, data)
+crypto_hash_sha512_final(state)
+crypto_kx_client_session_keys(client_pk, client_sk, server_pk)
+crypto_kx_keypair()
+crypto_kx_server_session_keys(server_pk, server_sk, client_pk)
+crypto_pwhash(outlen, passwd, salt, opslimit, memlimit, alg)
+crypto_pwhash_scryptsalsa208sha256(outlen, passwd, salt, opslimit, memlimit)
+crypto_pwhash_scryptsalsa208sha256_str(passwd, opslimit, memlimit)
+crypto_pwhash_scryptsalsa208sha256_str_verify(stored, passwd)
+crypto_pwhash_str(passwd, opslimit, memlimit)
+crypto_pwhash_str_verify(pstr, passwd)
+crypto_scalarmult_base(n)
+crypto_scalarmult_curve25519_base(n)
+crypto_scalarmult_curve25519(n, p)
+crypto_secretbox(msg, nonce, k)
+crypto_secretbox_detached(msg, nonce, k)
+crypto_secretbox_open(c, nonce, k)
+crypto_secretbox_open_detached(c, mac, nonce, k)
+crypto_secretstream_xchacha20poly1305_keygen():
+crypto_secretstream_xchacha20poly1305_init_push(key):
+crypto_secretstream_xchacha20poly1305_init_pull(header, key):
+crypto_secretstream_xchacha20poly1305_rekey(state):
+crypto_secretstream_xchacha20poly1305_push(state, message, ad, tag):
+crypto_secretstream_xchacha20poly1305_pull(state, ciphertext, ad):
+crypto_sign_init()
+crypto_sign_update(state, m)
+crypto_sign_final_create(state, sk)
+crypto_sign_final_verify(state, sig, pk)
+crypto_sign_detached(m, sk)
+crypto_sign_keypair()
+crypto_sign(m, sk)
+crypto_sign_open(sm, pk)
+crypto_sign_pk_to_box_pk(pk)
+crypto_sign_seed_keypair(seed)
+crypto_sign_sk_to_box_sk(sk)
+crypto_sign_sk_to_pk(sk)
+crypto_sign_sk_to_seed(sk)
+crypto_sign_verify_detached(sig, msg, pk)
+crypto_stream_chacha20_xor(message, nonce, key)
+crypto_stream_chacha20_xor_ic(message, nonce, initial_counter, key)
+crypto_stream_xchacha20_xor(message, nonce, key)
+crypto_stream_xchacha20_xor_ic(message, nonce, initial_counter, key)
+crypto_stream(cnt, nonce=None, key=None)
+crypto_stream_xor(msg, cnt, nonce=None, key=None)
+randombytes(size)
+sodium_increment(bytes)
+crypto_core_ristretto255_is_valid_point(p)
+crypto_core_ristretto255_from_hash(r)
+crypto_scalarmult_ristretto255(n, p)
+crypto_scalarmult_ristretto255_base(n)
+crypto_core_ristretto255_scalar_random()
+crypto_core_ristretto255_scalar_invert(s)
+crypto_core_ristretto255_scalar_reduce(s)
+crypto_core_ristretto255_add(p, q)
+crypto_core_ristretto255_sub(p,q)
+crypto_core_ristretto255_random()
+crypto_core_ristretto255_scalar_negate(s)
+crypto_core_ristretto255_scalar_complement(s)
+crypto_core_ristretto255_scalar_add(x,y)
+crypto_core_ristretto255_scalar_sub(x,y)
+crypto_core_ristretto255_scalar_mul(x,y)
+```
+
+Constants:
+
+```
+crypto_aead_chacha20poly1305_ABYTES
+crypto_aead_chacha20poly1305_KEYBYTES
+crypto_aead_chacha20poly1305_NPUBBYTES
+crypto_aead_chacha20poly1305_ietf_KEYBYTES
+crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+crypto_aead_chacha20poly1305_ietf_ABYTES
+crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+crypto_aead_xchacha20poly1305_ietf_ABYTES
+crypto_auth_BYTES
+crypto_auth_KEYBYTES
+crypto_box_BEFORENMBYTES
+crypto_box_BOXZEROBYTES
+crypto_box_MACBYTES
+crypto_box_NONCEBYTES
+crypto_box_PUBLICKEYBYTES
+crypto_box_SEALBYTES
+crypto_box_SECRETKEYBYTES
+crypto_box_SEEDBYTES
+crypto_box_ZEROBYTES
+crypto_generichash_KEYBYTES_MAX
+crypto_generichash_BYTES
+crypto_generichash_BYTES_MAX
+crypto_generichash_BYTES_MIN
+crypto_generichash_STATEBYTES
+crypto_generichash_blake2b_BYTES
+crypto_generichash_blake2b_BYTES_MAX
+crypto_generichash_blake2b_BYTES_MIN
+crypto_generichash_blake2b_KEYBYTES_MAX
+crypto_generichash_blake2b_PERSONALBYTES
+crypto_generichash_blake2b_SALTBYTES
+crypto_hash_sha256_BYTES
+crypto_hash_sha512_BYTES
+crypto_hash_sha512_STATEBYTES
+crypto_kx_PUBLICKEYBYTES
+crypto_kx_SECRETKEYBYTES
+crypto_kx_SESSIONKEYBYTES
+crypto_pwhash_ALG_DEFAULT
+crypto_pwhash_ALG_ARGON2I13
+crypto_pwhash_ALG_ARGON2ID13
+crypto_pwhash_BYTES_MAX
+crypto_pwhash_BYTES_MIN
+crypto_pwhash_MEMLIMIT_MAX
+crypto_pwhash_MEMLIMIT_MIN
+crypto_pwhash_MEMLIMIT_INTERACTIVE
+crypto_pwhash_MEMLIMIT_MODERATE
+crypto_pwhash_MEMLIMIT_SENSITIVE
+crypto_pwhash_OPSLIMIT_MAX
+crypto_pwhash_OPSLIMIT_MIN
+crypto_pwhash_OPSLIMIT_INTERACTIVE
+crypto_pwhash_OPSLIMIT_MODERATE
+crypto_pwhash_OPSLIMIT_SENSITIVE
+crypto_pwhash_PASSWD_MAX
+crypto_pwhash_PASSWD_MIN
+crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
+crypto_pwhash_argon2i_MEMLIMIT_MODERATE
+crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
+crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
+crypto_pwhash_argon2i_OPSLIMIT_MODERATE
+crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
+crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
+crypto_pwhash_argon2id_MEMLIMIT_MODERATE
+crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
+crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
+crypto_pwhash_argon2id_OPSLIMIT_MODERATE
+crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
+crypto_pwhash_SALTBYTES
+crypto_pwhash_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_BYTES_MAX
+crypto_pwhash_scryptsalsa208sha256_BYTES_MIN
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN
+crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+crypto_pwhash_scryptsalsa208sha256_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+crypto_scalarmult_BYTES
+crypto_scalarmult_SCALARBYTES
+crypto_scalarmult_curve25519_BYTES
+crypto_secretbox_BOXZEROBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_MACBYTES
+crypto_secretbox_NONCEBYTES
+crypto_secretbox_ZEROBYTES
+crypto_secretstream_xchacha20poly1305_STATEBYTES
+crypto_secretstream_xchacha20poly1305_ABYTES
+crypto_secretstream_xchacha20poly1305_HEADERBYTES
+crypto_secretstream_xchacha20poly1305_KEYBYTES
+crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
+crypto_secretstream_xchacha20poly1305_TAG_MESSAGE
+crypto_secretstream_xchacha20poly1305_TAG_PUSH
+crypto_secretstream_xchacha20poly1305_TAG_REKEY
+crypto_secretstream_xchacha20poly1305_TAG_FINAL
+crypto_sign_BYTES
+crypto_sign_PUBLICKEYBYTES
+crypto_sign_SECRETKEYBYTES
+crypto_sign_SEEDBYTES
+crypto_sign_ed25519_PUBLICKEYBYTES
+crypto_sign_ed25519_SECRETKEYBYTES
+crypto_stream_KEYBYTES
+crypto_stream_NONCEBYTES
+crypto_stream_chacha20_NONCEBYTES
+crypto_stream_chacha20_KEYBYTES
+crypto_stream_xchacha20_NONCEBYTES
+crypto_stream_xchacha20_KEYBYTES
+crypto_core_ristretto255_BYTES
+crypto_core_ristretto255_HASHBYTES
+crypto_core_ristretto255_SCALARBYTES
+crypto_core_ristretto255_NONREDUCEDSCALARBYTES
+```
+
+
+
+Note
+
+most of the the `*_easy` functions are not implemented as the "non-easy"
+functions provide already the "easy" interface, which hides the placement of
+buffers in memory, which makes little sense in python, so this wrapper handles
+this.
diff --git a/pysodium.egg-info/SOURCES.txt b/pysodium.egg-info/SOURCES.txt
index c8ae154..a4aea14 100644
--- a/pysodium.egg-info/SOURCES.txt
+++ b/pysodium.egg-info/SOURCES.txt
@@ -1,4 +1,5 @@
AUTHORS
+LICENSE.txt
MANIFEST.in
README.md
setup.py
@@ -7,5 +8,4 @@ pysodium.egg-info/PKG-INFO
pysodium.egg-info/SOURCES.txt
pysodium.egg-info/dependency_links.txt
pysodium.egg-info/top_level.txt
-test/__init__.py
test/test_pysodium.py
\ No newline at end of file
diff --git a/pysodium.egg-info/top_level.txt b/pysodium.egg-info/top_level.txt
index e91f29c..ac12a6c 100644
--- a/pysodium.egg-info/top_level.txt
+++ b/pysodium.egg-info/top_level.txt
@@ -1,2 +1 @@
pysodium
-test
diff --git a/pysodium/__init__.py b/pysodium/__init__.py
index f69d49a..ed94dba 100755
--- a/pysodium/__init__.py
+++ b/pysodium/__init__.py
@@ -120,6 +120,8 @@ crypto_stream_KEYBYTES = sodium.crypto_stream_keybytes()
crypto_stream_NONCEBYTES = sodium.crypto_stream_noncebytes()
crypto_stream_chacha20_NONCEBYTES = sodium.crypto_stream_chacha20_noncebytes()
crypto_stream_chacha20_KEYBYTES = sodium.crypto_stream_chacha20_keybytes()
+crypto_stream_xchacha20_NONCEBYTES = sodium.crypto_stream_xchacha20_noncebytes()
+crypto_stream_xchacha20_KEYBYTES = sodium.crypto_stream_xchacha20_keybytes()
crypto_generichash_KEYBYTES_MAX = sodium.crypto_generichash_keybytes_max()
crypto_generichash_BYTES = sodium.crypto_generichash_bytes()
crypto_generichash_BYTES_MIN = sodium.crypto_generichash_bytes_min()
@@ -143,6 +145,7 @@ crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE = sodium.crypto_pwhash_scr
crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE = sodium.crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive()
crypto_hash_sha256_BYTES = sodium.crypto_hash_sha256_bytes()
crypto_hash_sha512_BYTES = sodium.crypto_hash_sha512_bytes()
+crypto_hash_sha512_STATEBYTES = sodium.crypto_hash_sha512_statebytes()
crypto_aead_chacha20poly1305_KEYBYTES = sodium.crypto_aead_chacha20poly1305_keybytes()
crypto_aead_chacha20poly1305_NPUBBYTES = sodium.crypto_aead_chacha20poly1305_npubbytes()
crypto_aead_chacha20poly1305_NONCEBYTES = crypto_aead_chacha20poly1305_NPUBBYTES
@@ -151,20 +154,9 @@ crypto_aead_chacha20poly1305_ABYTES = sodium.crypto_aead_chacha20poly1305_abytes
if sodium_version_check(1, 0, 9):
crypto_aead_chacha20poly1305_ietf_KEYBYTES = sodium.crypto_aead_chacha20poly1305_ietf_keybytes()
crypto_aead_chacha20poly1305_ietf_NPUBBYTES = sodium.crypto_aead_chacha20poly1305_ietf_npubbytes()
+ crypto_aead_chacha20poly1305_ietf_ABYTES = sodium.crypto_aead_chacha20poly1305_ietf_abytes()
crypto_pwhash_SALTBYTES = sodium.crypto_pwhash_saltbytes()
crypto_pwhash_STRBYTES = sodium.crypto_pwhash_strbytes()
- sodium.crypto_pwhash_bytes_max.restype=ctypes.c_uint
- sodium.crypto_pwhash_opslimit_max.restype=ctypes.c_uint
- sodium.crypto_pwhash_memlimit_max.restype=ctypes.c_uint
- sodium.crypto_pwhash_passwd_max.restype=ctypes.c_uint
- crypto_pwhash_BYTES_MAX = sodium.crypto_pwhash_bytes_max()
- crypto_pwhash_BYTES_MIN = sodium.crypto_pwhash_bytes_min()
- crypto_pwhash_MEMLIMIT_MAX = sodium.crypto_pwhash_memlimit_max()
- crypto_pwhash_MEMLIMIT_MIN = sodium.crypto_pwhash_memlimit_min()
- crypto_pwhash_OPSLIMIT_MAX = sodium.crypto_pwhash_opslimit_max()
- crypto_pwhash_OPSLIMIT_MIN = sodium.crypto_pwhash_opslimit_min()
- crypto_pwhash_PASSWD_MAX = sodium.crypto_pwhash_passwd_max()
- crypto_pwhash_PASSWD_MIN = sodium.crypto_pwhash_passwd_min()
crypto_pwhash_OPSLIMIT_INTERACTIVE = sodium.crypto_pwhash_opslimit_interactive()
crypto_pwhash_MEMLIMIT_INTERACTIVE = sodium.crypto_pwhash_memlimit_interactive()
crypto_pwhash_OPSLIMIT_MODERATE = sodium.crypto_pwhash_opslimit_moderate()
@@ -183,6 +175,15 @@ else:
crypto_pwhash_ALG_DEFAULT = None
crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32
crypto_aead_chacha20poly1305_ietf_NPUBBYTES = 12
+ crypto_aead_chacha20poly1305_ietf_ABYTES = 16
+ crypto_pwhash_BYTES_MAX = 4294967295
+ crypto_pwhash_BYTES_MIN = 16
+ crypto_pwhash_MEMLIMIT_MAX = 4398046510080
+ crypto_pwhash_MEMLIMIT_MIN = 1
+ crypto_pwhash_OPSLIMIT_MAX = 4294967295
+ crypto_pwhash_OPSLIMIT_MIN = 3
+ crypto_pwhash_PASSWD_MAX = 4294967295
+ crypto_pwhash_PASSWD_MIN = 0
crypto_aead_chacha20poly1305_ietf_NONCEBYTES = crypto_aead_chacha20poly1305_ietf_NPUBBYTES
@@ -194,10 +195,22 @@ if sodium_version_check(1, 0, 12):
crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = sodium.crypto_aead_xchacha20poly1305_ietf_npubbytes()
crypto_aead_xchacha20poly1305_ietf_NONCEBYTES = crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
crypto_aead_xchacha20poly1305_ietf_ABYTES = sodium.crypto_aead_xchacha20poly1305_ietf_abytes()
+ sodium.crypto_pwhash_bytes_max.restype=ctypes.c_uint
+ sodium.crypto_pwhash_opslimit_max.restype=ctypes.c_uint
+ sodium.crypto_pwhash_memlimit_max.restype=ctypes.c_uint
+ sodium.crypto_pwhash_passwd_max.restype=ctypes.c_uint
sodium.crypto_pwhash_scryptsalsa208sha256_bytes_max.restype=ctypes.c_uint
sodium.crypto_pwhash_scryptsalsa208sha256_opslimit_max.restype=ctypes.c_uint
sodium.crypto_pwhash_scryptsalsa208sha256_memlimit_max.restype=ctypes.c_ulonglong
sodium.crypto_pwhash_scryptsalsa208sha256_passwd_max.restype=ctypes.c_uint
+ crypto_pwhash_BYTES_MAX = sodium.crypto_pwhash_bytes_max()
+ crypto_pwhash_BYTES_MIN = sodium.crypto_pwhash_bytes_min()
+ crypto_pwhash_MEMLIMIT_MAX = sodium.crypto_pwhash_memlimit_max()
+ crypto_pwhash_MEMLIMIT_MIN = sodium.crypto_pwhash_memlimit_min()
+ crypto_pwhash_OPSLIMIT_MAX = sodium.crypto_pwhash_opslimit_max()
+ crypto_pwhash_OPSLIMIT_MIN = sodium.crypto_pwhash_opslimit_min()
+ crypto_pwhash_PASSWD_MAX = sodium.crypto_pwhash_passwd_max()
+ crypto_pwhash_PASSWD_MIN = sodium.crypto_pwhash_passwd_min()
crypto_pwhash_scryptsalsa208sha256_BYTES_MAX = sodium.crypto_pwhash_scryptsalsa208sha256_bytes_max()
crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = sodium.crypto_pwhash_scryptsalsa208sha256_bytes_min()
crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX = sodium.crypto_pwhash_scryptsalsa208sha256_memlimit_max()
@@ -236,6 +249,16 @@ if sodium_version_check(1, 0, 15):
crypto_secretstream_xchacha20poly1305_TAG_REKEY = sodium.crypto_secretstream_xchacha20poly1305_tag_rekey()
crypto_secretstream_xchacha20poly1305_TAG_FINAL = sodium.crypto_secretstream_xchacha20poly1305_tag_final()
+if sodium_version_check(1, 0, 18):
+ crypto_core_ristretto255_BYTES = sodium.crypto_core_ristretto255_bytes()
+ crypto_core_ristretto255_HASHBYTES = sodium.crypto_core_ristretto255_hashbytes()
+ crypto_core_ristretto255_SCALARBYTES = sodium.crypto_core_ristretto255_scalarbytes()
+ crypto_core_ristretto255_NONREDUCEDSCALARBYTES = sodium.crypto_core_ristretto255_nonreducedscalarbytes()
+ crypto_auth_hmacsha256_BYTES = sodium.crypto_auth_hmacsha256_bytes()
+ crypto_hash_sha256_STATEBYTES = sodium.crypto_hash_sha256_statebytes()
+ crypto_auth_hmacsha512_BYTES = sodium.crypto_auth_hmacsha512_bytes()
+ crypto_hash_sha512_STATEBYTES = sodium.crypto_hash_sha512_statebytes()
+
sodium_init = sodium.sodium_init
class CryptoSignState(ctypes.Structure):
@@ -262,6 +285,15 @@ def pad_buf(buf, length, name = 'buf'):
else:
return buf
+# int crypto_scalarmult_base(unsigned char *q, const unsigned char *n);
+def crypto_scalarmult_base(n):
+ if n is None:
+ raise ValueError("invalid parameters")
+ if len(n) != crypto_scalarmult_SCALARBYTES: raise ValueError("truncated scalar")
+ q = ctypes.create_string_buffer(crypto_scalarmult_BYTES)
+ __check(sodium.crypto_scalarmult_base(q, n))
+ return q.raw
+
def crypto_scalarmult_curve25519(n, p):
if None in (n,p):
raise ValueError("invalid parameters")
@@ -277,7 +309,7 @@ def crypto_scalarmult_curve25519_base(n):
raise ValueError("invalid parameters")
if len(n) != crypto_scalarmult_SCALARBYTES: raise ValueError("truncated scalar")
buf = ctypes.create_string_buffer(crypto_scalarmult_BYTES)
- __check(sodium.crypto_scalarmult_curve25519_base(ctypes.byref(buf), n))
+ __check(sodium.crypto_scalarmult_curve25519_base(buf, n))
return buf.raw
# crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *k)
@@ -293,6 +325,46 @@ def crypto_stream_chacha20_xor(message, nonce, key):
return c.raw
+# crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, const unsigned char *k)
+def crypto_stream_chacha20_xor_ic(message, nonce, initial_counter, key):
+ if len(nonce) != crypto_stream_chacha20_NONCEBYTES: raise ValueError("truncated nonce")
+ if len(key) != crypto_stream_chacha20_KEYBYTES: raise ValueError("truncated key")
+
+ mlen = ctypes.c_longlong(len(message))
+ ic = ctypes.c_uint64(initial_counter)
+
+ c = ctypes.create_string_buffer(len(message))
+
+ __check(sodium.crypto_stream_chacha20_xor_ic(c, message, mlen, nonce, ic, key))
+
+ return c.raw
+
+# crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, const unsigned char *k)
+def crypto_stream_xchacha20_xor(message, nonce, key):
+ if len(nonce) != crypto_stream_xchacha20_NONCEBYTES: raise ValueError("truncated nonce")
+ if len(key) != crypto_stream_xchacha20_KEYBYTES: raise ValueError("truncated key")
+
+ mlen = ctypes.c_longlong(len(message))
+
+ c = ctypes.create_string_buffer(len(message))
+
+ __check(sodium.crypto_stream_xchacha20_xor(c, message, mlen, nonce, key))
+
+ return c.raw
+
+# crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m, unsigned long long mlen, const unsigned char *n, uint64_t ic, const unsigned char *k)
+def crypto_stream_xchacha20_xor_ic(message, nonce, initial_counter, key):
+ if len(nonce) != crypto_stream_xchacha20_NONCEBYTES: raise ValueError("truncated nonce")
+ if len(key) != crypto_stream_xchacha20_KEYBYTES: raise ValueError("truncated key")
+
+ mlen = ctypes.c_longlong(len(message))
+ ic = ctypes.c_uint64(initial_counter)
+
+ c = ctypes.create_string_buffer(len(message))
+
+ __check(sodium.crypto_stream_xchacha20_xor_ic(c, message, mlen, nonce, ic, key))
+
+ return c.raw
# crypto_aead_chacha20poly1305_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k);
def crypto_aead_chacha20poly1305_encrypt(message, ad, nonce, key):
@@ -379,6 +451,37 @@ def crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key):
__check(sodium.crypto_aead_chacha20poly1305_ietf_decrypt(m, ctypes.byref(mlen), None, ciphertext, clen, ad, adlen, nonce, key))
return m.raw
+# crypto_aead_chacha20poly1305_ietf_encrypt_detached(unsigned char *c, unsigned char *mac, unsigned long long *maclen_p, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
+@sodium_version(1, 0, 9)
+def crypto_aead_chacha20poly1305_ietf_encrypt_detached(message, ad, nonce, key):
+ """ Return ciphertext, mac tag """
+ if len(nonce) != crypto_aead_chacha20poly1305_ietf_NONCEBYTES: raise ValueError("truncated nonce")
+ if len(key) != crypto_aead_chacha20poly1305_ietf_KEYBYTES: raise ValueError("truncated key")
+
+ mlen = ctypes.c_ulonglong(len(message))
+ adlen = ctypes.c_ulonglong(len(ad)) if ad is not None else ctypes.c_ulonglong(0)
+ c = ctypes.create_string_buffer(mlen.value)
+ maclen_p = ctypes.c_ulonglong(crypto_aead_chacha20poly1305_ietf_ABYTES)
+ mac = ctypes.create_string_buffer(maclen_p.value)
+
+ __check(sodium.crypto_aead_chacha20poly1305_ietf_encrypt_detached(c, mac, ctypes.byref(maclen_p), message, mlen, ad, adlen, None, nonce, key))
+ return c.raw, mac.raw
+
+# crypto_aead_chacha20poly1305_ietf_decrypt_detached(unsigned char *m, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *mac, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
+@sodium_version(1, 0, 9)
+def crypto_aead_chacha20poly1305_ietf_decrypt_detached(ciphertext, mac, ad, nonce, key):
+ """ Return message if successful or -1 (ValueError) if not successful"""
+ if len(nonce) != crypto_aead_chacha20poly1305_ietf_NONCEBYTES: raise ValueError("truncated nonce")
+ if len(key) != crypto_aead_chacha20poly1305_ietf_KEYBYTES: raise ValueError("truncated key")
+ if len(mac) != crypto_aead_chacha20poly1305_ietf_ABYTES:
+ raise ValueError("mac length != %i" % crypto_aead_chacha20poly1305_ietf_ABYTES)
+
+ clen = ctypes.c_ulonglong(len(ciphertext))
+ m = ctypes.create_string_buffer(clen.value)
+ adlen = ctypes.c_ulonglong(len(ad)) if ad is not None else ctypes.c_ulonglong(0)
+ __check(sodium.crypto_aead_chacha20poly1305_ietf_decrypt_detached(m, None, ciphertext, clen, mac, ad, adlen, nonce, key))
+ return m.raw
+
#crypto_aead_xchacha20poly1305_ietf_encrypt(ciphertext, &ciphertext_len,
# message, message_len,
# additional_data, additional_data_len,
@@ -420,22 +523,27 @@ def crypto_aead_xchacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key):
return m.raw
# crypto_auth(unsigned char *out, const unsigned char *in, unsigned long long inlen, const unsigned char *k)
-def crypto_auth(m, k=b''):
- if m is None:
+def crypto_auth(m, k):
+ if m is None or k is None:
raise ValueError("invalid parameters")
+ if len(k) != crypto_auth_KEYBYTES:
+ raise ValueError("invalid key")
buf = ctypes.create_string_buffer(crypto_auth_BYTES)
__check(sodium.crypto_auth(buf, m, ctypes.c_ulonglong(len(m)), k))
return buf.raw
# crypto_auth_verify(const unsigned char *h, const unsigned char *in, unsigned long long inlen, const unsigned char *k)
-def crypto_auth_verify(h, m, k=b''):
- if h is None or m is None:
+def crypto_auth_verify(h, m, k):
+ if h is None or m is None or k is None:
raise ValueError("invalid parameters")
+ if len(k) != crypto_auth_KEYBYTES:
+ raise ValueError("invalid key")
if len(h) != crypto_auth_BYTES:
raise ValueError("invalid tag")
__check(sodium.crypto_auth_verify(h, m, ctypes.c_ulonglong(len(m)), k))
# crypto_generichash(unsigned char *out, size_t outlen, const unsigned char *in, unsigned long long inlen, const unsigned char *key, size_t keylen)
+@encode_strings
def crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES):
buf = ctypes.create_string_buffer(outlen)
__check(sodium.crypto_generichash(buf, ctypes.c_size_t(outlen), m, ctypes.c_ulonglong(len(m)), k, ctypes.c_size_t(len(k))))
@@ -443,6 +551,7 @@ def crypto_generichash(m, k=b'', outlen=crypto_generichash_BYTES):
# crypto_generichash_init(crypto_generichash_state *state, const unsigned char *key, const size_t keylen, const size_t outlen);
+@encode_strings
def crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b''):
state = ctypes.create_string_buffer(crypto_generichash_STATEBYTES)
__check(sodium.crypto_generichash_init(ctypes.byref(state), k, ctypes.c_size_t(len(k)), ctypes.c_size_t(outlen)))
@@ -450,6 +559,7 @@ def crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b''):
# crypto_generichash_update(crypto_generichash_state *state, const unsigned char *in, unsigned long long inlen);
+@encode_strings
def crypto_generichash_update(state, m):
if len(state) != crypto_generichash_STATEBYTES: raise ValueError("invalid state")
__check(sodium.crypto_generichash_update(ctypes.byref(state), m, ctypes.c_ulonglong(len(m))))
@@ -556,7 +666,7 @@ def crypto_secretbox(msg, nonce, k):
if None in (msg, nonce, k):
raise ValueError("invalid parameters")
if len(k) != crypto_secretbox_KEYBYTES: raise ValueError("k incorrect size")
- if len(nonce) != crypto_box_NONCEBYTES: raise ValueError("nonce incorrect size")
+ if len(nonce) != crypto_secretbox_NONCEBYTES: raise ValueError("nonce incorrect size")
padded = b"\x00" * crypto_secretbox_ZEROBYTES + msg
c = ctypes.create_string_buffer(len(padded))
__check(sodium.crypto_secretbox(c, padded, ctypes.c_ulonglong(len(padded)), nonce, k))
@@ -567,7 +677,7 @@ def crypto_secretbox_open(c, nonce, k):
if None in (c, nonce, k):
raise ValueError("invalid parameters")
if len(k) != crypto_secretbox_KEYBYTES: raise ValueError("k incorrect size")
- if len(nonce) != crypto_box_NONCEBYTES: raise ValueError("nonce incorrect size")
+ if len(nonce) != crypto_secretbox_NONCEBYTES: raise ValueError("nonce incorrect size")
padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + c
msg = ctypes.create_string_buffer(len(padded))
__check(sodium.crypto_secretbox_open(msg, padded, ctypes.c_ulonglong(len(padded)), nonce, k))
@@ -599,6 +709,38 @@ def crypto_box_seal_open(c, pk, sk):
__check(sodium.crypto_box_seal_open(msg, c, ctypes.c_ulonglong(len(c)), pk, sk))
return msg.raw
+# int crypto_secretbox_detached(unsigned char *c, unsigned char *mac,
+# const unsigned char *m,
+# unsigned long long mlen,
+# const unsigned char *n,
+# const unsigned char *k);
+
+def crypto_secretbox_detached(msg, nonce, k):
+ if None in (msg, nonce, k): raise ValueError("invalid parameters")
+ if len(k) != crypto_secretbox_KEYBYTES: raise ValueError("key incorrect size")
+ if len(nonce) != crypto_secretbox_NONCEBYTES: raise ValueError("nonce incorrect size")
+ c = ctypes.create_string_buffer(len(msg))
+ mac = ctypes.create_string_buffer(crypto_secretbox_MACBYTES)
+ __check(sodium.crypto_secretbox_detached(c, mac, msg, ctypes.c_ulonglong(len(msg)), nonce, k))
+ return c.raw, mac.raw
+
+
+# int crypto_secretbox_open_detached(unsigned char *m,
+# const unsigned char *c,
+# const unsigned char *mac,
+# unsigned long long clen,
+# const unsigned char *n,
+# const unsigned char *k);
+
+def crypto_secretbox_open_detached(c, mac, nonce, k):
+ if None in (c, mac, nonce, k):
+ raise ValueError("invalid parameters")
+ if len(k) != crypto_secretbox_KEYBYTES: raise ValueError("key incorrect size")
+ if len(nonce) != crypto_secretbox_NONCEBYTES: raise ValueError("nonce incorrect size")
+ msg = ctypes.create_string_buffer(len(c))
+ __check(sodium.crypto_secretbox_open_detached(msg, c, mac, ctypes.c_ulonglong(len(c)), nonce, k))
+ return msg.raw
+
# int crypto_box_detached(unsigned char *c, unsigned char *mac,
# const unsigned char *m, unsigned long long mlen,
@@ -1014,6 +1156,23 @@ def crypto_hash_sha512(message):
__check(sodium.crypto_hash_sha512(out, message, ctypes.c_ulonglong(len(message))))
return out.raw
+# int crypto_hash_sha512_init(crypto_hash_sha512_state *state)
+def crypto_hash_sha512_init():
+ state = ctypes.create_string_buffer(crypto_hash_sha512_STATEBYTES)
+ __check(sodium.crypto_hash_sha512_init(state))
+ return state
+
+# int crypto_hash_sha512_update(crypto_hash_sha512_state *state, const unsigned char *in, unsigned long long inlen)
+def crypto_hash_sha512_update(state, data):
+ __check(sodium.crypto_hash_sha512_update(state,data,ctypes.c_ulonglong(len(data))))
+ return state
+
+# int crypto_hash_sha512_final(crypto_hash_sha512_state *state, unsigned char *out)
+def crypto_hash_sha512_final(state):
+ out = ctypes.create_string_buffer(crypto_hash_sha512_BYTES)
+ __check(sodium.crypto_hash_sha512_final(state, out))
+ return out.raw
+
# int crypto_kx_keypair(unsigned char pk[crypto_kx_PUBLICKEYBYTES],
# unsigned char sk[crypto_kx_SECRETKEYBYTES]);
@sodium_version(1, 0, 12)
@@ -1058,3 +1217,134 @@ def crypto_kx_server_session_keys(server_pk, server_sk, client_pk):
tx = ctypes.create_string_buffer(crypto_kx_SESSIONKEYBYTES)
__check(sodium.crypto_kx_server_session_keys(rx, tx, server_pk, server_sk, client_pk))
return rx.raw, tx.raw
+
+# void sodium_increment(unsigned char *n, const size_t nlen)
+@sodium_version(1, 0, 4)
+def sodium_increment(n):
+ sodium.sodium_increment(n, ctypes.c_size_t(len(n)))
+
+
+# int crypto_core_ristretto255_is_valid_point(const unsigned char *p);
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_is_valid_point(p):
+ return sodium.crypto_core_ristretto255_is_valid_point(p) == 1
+
+# int crypto_core_ristretto255_from_hash(unsigned char *p, const unsigned char *r);
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_from_hash(r):
+ if len(r) != crypto_core_ristretto255_HASHBYTES: raise ValueError("Invalid parameter, must be {} bytes".format(crypto_core_ristretto255_HASHBYTES))
+ p = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ __check(sodium.crypto_core_ristretto255_from_hash(p,r))
+ return p.raw
+
+# int crypto_scalarmult_ristretto255(unsigned char *q, const unsigned char *n, const unsigned char *p);
+@sodium_version(1, 0, 18)
+def crypto_scalarmult_ristretto255(n, p):
+ if None in (n,p):
+ raise ValueError("invalid parameters")
+ if len(n) != crypto_core_ristretto255_SCALARBYTES: raise ValueError("truncated scalar")
+ if len(p) != crypto_core_ristretto255_BYTES: raise ValueError("truncated point")
+ buf = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ __check(sodium.crypto_scalarmult_ristretto255(buf, n, p))
+ return buf.raw
+
+# int crypto_scalarmult_ristretto255_base(unsigned char *q, const unsigned char *n);
+@sodium_version(1, 0, 18)
+def crypto_scalarmult_ristretto255_base(n):
+ if n is None:
+ raise ValueError("invalid parameters")
+ if len(n) != crypto_core_ristretto255_SCALARBYTES: raise ValueError("truncated scalar")
+ buf = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ __check(sodium.crypto_scalarmult_ristretto255_base(buf, n))
+ return buf.raw
+
+# void crypto_core_ristretto255_scalar_random(unsigned char *r);
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_random():
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_random(r)
+ return r.raw
+
+# int crypto_core_ristretto255_scalar_invert(unsigned char *recip, const unsigned char *s);
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_invert(s):
+ if not s or len(s)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ __check(sodium.crypto_core_ristretto255_scalar_invert(r,s))
+ return r.raw
+
+# void crypto_core_ristretto255_scalar_reduce(unsigned char *r, const unsigned char *s);
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_reduce(s):
+ if not s or len(s)!=crypto_core_ristretto255_NONREDUCEDSCALARBYTES: raise ValueError("Invalid parameter: must be {} bytes".format(crypto_core_ristretto255_NONREDUCEDSCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_reduce(r,s)
+ return r.raw
+
+# int crypto_core_ristretto255_add(unsigned char *r, const unsigned char *p, const unsigned char *q)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_add(p, q):
+ if len(p) != crypto_core_ristretto255_BYTES: raise ValueError("truncated point p")
+ if len(q) != crypto_core_ristretto255_BYTES: raise ValueError("truncated point q")
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ __check(sodium.crypto_core_ristretto255_add(r, p, q))
+ return r.raw
+
+# int crypto_core_ristretto255_sub(unsigned char *r, const unsigned char *p, const unsigned char *q)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_sub(p,q):
+ if len(p) != crypto_core_ristretto255_BYTES: raise ValueError("truncated point p")
+ if len(q) != crypto_core_ristretto255_BYTES: raise ValueError("truncated point q")
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ __check(sodium.crypto_core_ristretto255_sub(r, p, q))
+ return r.raw
+
+# void crypto_core_ristretto255_random(unsigned char *p)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_random():
+ p = ctypes.create_string_buffer(crypto_core_ristretto255_BYTES)
+ sodium.crypto_core_ristretto255_random(p)
+ return p.raw
+
+# void crypto_core_ristretto255_scalar_negate(unsigned char *neg, const unsigned char *s)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_negate(s):
+ if not s or len(s)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_negate(r,s)
+ return r.raw
+
+# void crypto_core_ristretto255_scalar_complement(unsigned char *comp, const unsigned char *s)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_complement(s):
+ if not s or len(s)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_complement(r,s)
+ return r.raw
+
+# void crypto_core_ristretto255_scalar_add(unsigned char *z, const unsigned char *x, const unsigned char *y)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_add(x,y):
+ if not x or len(x)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ if not y or len(y)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_add(r,x,y)
+ return r.raw
+
+# void crypto_core_ristretto255_scalar_sub(unsigned char *z, const unsigned char *x, const unsigned char *y)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_sub(x,y):
+ if not x or len(x)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ if not y or len(y)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_sub(r,x,y)
+ return r.raw
+
+# void crypto_core_ristretto255_scalar_mul(unsigned char *z, const unsigned char *x, const unsigned char *y)
+@sodium_version(1, 0, 18)
+def crypto_core_ristretto255_scalar_mul(x,y):
+ if not x or len(x)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ if not y or len(y)!=crypto_core_ristretto255_SCALARBYTES: raise ValueError("Invalid param, must be {} bytes".format(crypto_core_ristretto255_SCALARBYTES))
+ r = ctypes.create_string_buffer(crypto_core_ristretto255_SCALARBYTES)
+ sodium.crypto_core_ristretto255_scalar_mul(r,x,y)
+ return r.raw
diff --git a/setup.py b/setup.py
index 451e316..991e144 100644
--- a/setup.py
+++ b/setup.py
@@ -11,14 +11,14 @@ def read(fname):
setup(
name="pysodium",
- version="0.7.0_0",
+ version="0.7.12",
author="Stefan Marsiske",
author_email="s@ctrlc.hu",
description="python libsodium wrapper",
license="BSD",
keywords="cryptography API NaCl libsodium",
url="https://github.com/stef/pysodium",
- packages=find_packages(),
+ packages=find_packages(exclude=['test*']),
long_description=read('README.md'),
requires=["libsodium"],
classifiers=["Development Status :: 4 - Beta",
diff --git a/test/__init__.py b/test/__init__.py
deleted file mode 100644
index 8b13789..0000000
--- a/test/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/test_pysodium.py b/test/test_pysodium.py
index f76c48a..22752d7 100755
--- a/test/test_pysodium.py
+++ b/test/test_pysodium.py
@@ -27,9 +27,9 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
-import pysodium
import unittest
import binascii
+import pysodium
class TestPySodium(unittest.TestCase):
@@ -59,6 +59,9 @@ class TestPySodium(unittest.TestCase):
self.assertEqual(r, r1)
self.assertEqual(r6, r61)
+ self.assertNotEqual(pysodium.crypto_generichash( 'salt0'), pysodium.crypto_generichash( 'salt1'))
+ self.assertNotEqual(pysodium.crypto_generichash(b'salt0'), pysodium.crypto_generichash(b'salt1'))
+
def test_crypto_box_pk_from_sk(self):
pk1, sk = pysodium.crypto_box_keypair()
pk2 = pysodium.crypto_scalarmult_curve25519_base(sk)
@@ -88,6 +91,16 @@ class TestPySodium(unittest.TestCase):
plaintext = pysodium.crypto_box_open_afternm(c, n, k)
self.assertEqual(m, plaintext)
+ def test_crypto_secretbox_open_detached(self):
+ m = b"howdy"
+ n = pysodium.randombytes(pysodium.crypto_secretbox_NONCEBYTES)
+ k = pysodium.randombytes(pysodium.crypto_secretbox_KEYBYTES)
+ c, mac = pysodium.crypto_secretbox_detached(m, n, k)
+ mplain = pysodium.crypto_secretbox_open_detached(c, mac, n, k)
+ self.assertEqual(m, mplain)
+ changed = b"\0"*len(c)
+ self.assertRaises(ValueError, pysodium.crypto_secretbox_open_detached, changed, mac, n, k)
+
def test_crypto_box_open_detached(self):
pk, sk = pysodium.crypto_box_keypair()
n = pysodium.randombytes(pysodium.crypto_box_NONCEBYTES)
@@ -260,7 +273,16 @@ class TestPySodium(unittest.TestCase):
state2 = pysodium.crypto_secretstream_xchacha20poly1305_init_pull(header, key)
self.assertRaises(ValueError, pysodium.crypto_secretstream_xchacha20poly1305_pull, state2, ciphertext2, None)
- def test_test_crypto_scalarmult_curve25519_base(self):
+ def test_crypto_scalarmult_base(self):
+ # In the C code, crypto_scalarmult_base just delegates to
+ # crypto_scalarmult_curve25519_base. If libsodium changes the preferred
+ # algorithm, this answer will change.
+ k = binascii.unhexlify(b"e38e290880cee71a0cbb7b09328fd034c1fe4bd8838b19ab303a64a8c6b01456")
+ expected = binascii.unhexlify(b"4aa82c2514ed88eb46085369a45ddd0db997e53bfee877c4556ab49a1581e545")
+ actual = pysodium.crypto_scalarmult_base(k)
+ self.assertEqual(expected, actual)
+
+ def test_crypto_scalarmult_curve25519_base(self):
s = pysodium.crypto_scalarmult_curve25519_base(pysodium.randombytes(pysodium.crypto_scalarmult_BYTES))
r = pysodium.crypto_scalarmult_curve25519_base(pysodium.randombytes(pysodium.crypto_scalarmult_BYTES))
pysodium.crypto_scalarmult_curve25519(s, r)
@@ -318,6 +340,21 @@ class TestPySodium(unittest.TestCase):
output = pysodium.crypto_aead_chacha20poly1305_ietf_decrypt(output, ad, nonce, key)
self.assertEqual(output, input_)
+ def test_aead_chacha20poly1305_ietf_detached(self):
+ if not pysodium.sodium_version_check(1, 0, 9): return
+ key = binascii.unhexlify(b"4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd1100a1007")
+ input_ = binascii.unhexlify(b"86d09974840bded2a5ca")
+ nonce = binascii.unhexlify(b"cd7cf67be39c794acd7cf67b")
+ for ad, ct in [
+ (binascii.unhexlify(b"87e229d4500845a079c0"), b"09394ed41cf16d3c0820c5e0caf8a7bf"),
+ (None, b"07bf99e3c0d8aaac48c04e1f93b12a63"),
+ ]:
+ output, mac = pysodium.crypto_aead_chacha20poly1305_ietf_encrypt_detached(input_, ad, nonce, key)
+ self.assertEqual(binascii.unhexlify(b"eef4c561bdda5ef7e044"), output)
+ self.assertEqual(binascii.unhexlify(ct), mac)
+ output = pysodium.crypto_aead_chacha20poly1305_ietf_decrypt_detached(output, mac, ad, nonce, key)
+ self.assertEqual(output, input_)
+
def test_aead_xchacha20poly1305_ietf(self):
if not pysodium.sodium_version_check(1, 0, 12): return
key = binascii.unhexlify(b"4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd1100a1007")
@@ -336,6 +373,30 @@ class TestPySodium(unittest.TestCase):
self.assertEqual(binascii.unhexlify(b"f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2be8241a38008b9a26bc35941e2444177c8ade6689de95264986d95889fb60e84629c9bd9a5acb1cc118be563eb9b3a4a472f82e09a7e778492b562ef7130e88dfe031c79db9d4f7c7a899151b9a475032b63fc385245fe054e3dd5a97a5f576fe064025d3ce042c566ab2c507b138db853e3d6959660996546cc9c4a6eafdc777c040d70eaf46f76dad3979e5c5360c3317166a1c894c94a371876a94df7628fe4eaaf2ccb27d5aaae0ad7ad0f9d4b6ad3b54098746d4524d38407a6deb3ab78fab78c9"),
output)
+ def test_crypto_stream_chacha20_xor_ic(self):
+ key = binascii.unhexlify(b"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")
+ nonce = binascii.unhexlify(b"0001020304050607")
+ input_ = b'\x00' * 128
+ ic = 2
+ output = pysodium.crypto_stream_chacha20_xor_ic(input_, nonce, ic, key)
+ self.assertEqual(binascii.unhexlify(b"9db9d4f7c7a899151b9a475032b63fc385245fe054e3dd5a97a5f576fe064025d3ce042c566ab2c507b138db853e3d6959660996546cc9c4a6eafdc777c040d70eaf46f76dad3979e5c5360c3317166a1c894c94a371876a94df7628fe4eaaf2ccb27d5aaae0ad7ad0f9d4b6ad3b54098746d4524d38407a6deb3ab78fab78c9"), output)
+
+ def test_crypto_stream_xchacha20_xor(self):
+ # test vectors taken from:
+ # https://github.com/jedisct1/libsodium/blob/609e42be75589f91179d218e24f5e35a7124abfd/test/default/xchacha20.c#L102
+ key = binascii.unhexlify("9d23bd4149cb979ccf3c5c94dd217e9808cb0e50cd0f67812235eaaf601d6232")
+ nonce = binascii.unhexlify("c047548266b7c370d33566a2425cbf30d82d1eaf5294109e")
+ out = binascii.unhexlify("a21209096594de8c5667b1d13ad93f744106d054df210e4782cd396fec692d3515a20bf351eec011a92c367888bc464c32f0807acd6c203a247e0db854148468e9f96bee4cf718d68d5f637cbd5a376457788e6fae90fc31097cfc")
+ output = pysodium.crypto_stream_xchacha20_xor(out, nonce, key)
+ self.assertEqual(b'\x00'*len(output), output)
+
+ def test_crypto_stream_xchacha20_xor_ic(self):
+ key = binascii.unhexlify("9d23bd4149cb979ccf3c5c94dd217e9808cb0e50cd0f67812235eaaf601d6232")
+ nonce = binascii.unhexlify("c047548266b7c370d33566a2425cbf30d82d1eaf5294109e")
+ out = binascii.unhexlify("a21209096594de8c5667b1d13ad93f744106d054df210e4782cd396fec692d3515a20bf351eec011a92c367888bc464c32f0807acd6c203a247e0db854148468e9f96bee4cf718d68d5f637cbd5a376457788e6fae90fc31097cfc")
+ output = pysodium.crypto_stream_xchacha20_xor_ic(out, nonce, 0, key)
+ self.assertEqual(b'\x00'*len(output), output)
+
def test_crypto_blake2b(self):
message = binascii.unhexlify(b'54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f67')
key = binascii.unhexlify(b'000102030405060708090a0b0c0d0e0f')
@@ -456,18 +517,15 @@ class TestPySodium(unittest.TestCase):
self.assertEqual(self.byteHashToString(pysodium.crypto_hash_sha512(b"\x80")),
"dfe8ef54110b3324d3b889035c95cfb80c92704614bf76f17546ad4f4b08218a630e16da7df34766a975b3bb85b01df9e99a4ec0a1d0ec3de6bed7b7a40b2f10")
+ def test_crypto_hash_sha512_steps(self):
+ s = pysodium.crypto_hash_sha512_init()
+ pysodium.crypto_hash_sha512_update(s, b"Correct Horse ")
+ pysodium.crypto_hash_sha512_update(s, b"Battery Staple")
+ self.assertEqual(self.byteHashToString(pysodium.crypto_hash_sha512_final(s)),
+ "0675070bda47bef936f0b65ae721d90f82ca137841df4d7cae27776501ae4b446ab926d64dc1d282c8758ac0eb02cc4aa11b2452d4f8ffeb795023b797fe2b80")
+
def byteHashToString(self, input):
- import sys
- result = ""
- for i in range(0, len(input)):
- if sys.version_info.major == 3:
- tmp = str(hex(ord(chr(input[i]))))[2:]
- else:
- tmp = str(hex(ord(input[i])))[2:]
- if len(tmp) is 1:
- tmp = "0" + tmp
- result += tmp
- return result
+ return binascii.hexlify(input).decode('utf8')
def test_crypto_auth(self):
sk = pysodium.randombytes(pysodium.crypto_auth_KEYBYTES)
@@ -485,5 +543,107 @@ class TestPySodium(unittest.TestCase):
self.assertEqual(crx, stx)
self.assertEqual(ctx, srx)
+ def test_sodium_inc(self):
+ r = b'A' * 32
+ pysodium.sodium_increment(r)
+ self.assertEqual(r, b'BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')
+
+ def test_crypto_core_ristretto255_scalar_random(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ a = pysodium.crypto_core_ristretto255_scalar_random()
+ b = pysodium.crypto_core_ristretto255_scalar_random()
+ # stupid check that random returns different values...
+ self.assertNotEqual(a,b)
+
+ def test_crypto_core_ristretto255_random(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ a = pysodium.crypto_core_ristretto255_random()
+ b = pysodium.crypto_core_ristretto255_random()
+ # same stupid check that random returns different values...
+ self.assertNotEqual(a,b)
+
+ def test_crypto_core_ristretto255_is_valid_point(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ invalid = binascii.unhexlify(b"ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f")
+ self.assertEqual(False, pysodium.crypto_core_ristretto255_is_valid_point(invalid))
+ invalid = binascii.unhexlify(b"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f")
+ self.assertEqual(False, pysodium.crypto_core_ristretto255_is_valid_point(invalid))
+
+ def test_crypto_core_ristretto255_from_hash(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ h = pysodium.crypto_generichash(b'howdy', outlen=pysodium.crypto_core_ristretto255_HASHBYTES)
+ p = pysodium.crypto_core_ristretto255_from_hash(h)
+ pysodium.crypto_core_ristretto255_is_valid_point(p)
+
+ def test_crypto_scalarmult_ristretto255_base(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ p = pysodium.crypto_scalarmult_ristretto255_base(pysodium.crypto_core_ristretto255_scalar_random())
+ pysodium.crypto_core_ristretto255_is_valid_point(p)
+
+ def test_crypto_scalarmult_ristretto255(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ n = pysodium.crypto_scalarmult_ristretto255_base(pysodium.crypto_core_ristretto255_scalar_random())
+ p = pysodium.crypto_scalarmult_ristretto255_base(pysodium.crypto_core_ristretto255_scalar_random())
+ r = pysodium.crypto_scalarmult_ristretto255(n, p)
+ pysodium.crypto_core_ristretto255_is_valid_point(r)
+
+ def test_crypto_core_ristretto255_scalar_invert(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ s = pysodium.crypto_core_ristretto255_scalar_random()
+ r = pysodium.crypto_core_ristretto255_scalar_invert(s)
+ p = pysodium.crypto_scalarmult_ristretto255_base(pysodium.crypto_core_ristretto255_scalar_random())
+ q = pysodium.crypto_scalarmult_ristretto255(s, p)
+ p_ = pysodium.crypto_scalarmult_ristretto255(r, q)
+ self.assertEqual(p,p_)
+
+ def test_crypto_core_ristretto255_add_sub(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ p = pysodium.crypto_core_ristretto255_random()
+ q = pysodium.crypto_core_ristretto255_random()
+
+ p_q = pysodium.crypto_core_ristretto255_add(p, q)
+ r = pysodium.crypto_core_ristretto255_sub(p_q,q)
+ self.assertEqual(p,r)
+
+ def test_crypto_core_ristretto255_scalar_add_sub(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+
+ x = pysodium.crypto_core_ristretto255_scalar_random()
+ y = pysodium.crypto_core_ristretto255_scalar_random()
+ x_y = pysodium.crypto_core_ristretto255_scalar_add(x,y)
+ r = pysodium.crypto_core_ristretto255_scalar_sub(x_y,y)
+
+ p1 = pysodium.crypto_scalarmult_ristretto255_base(x)
+ p2 = pysodium.crypto_scalarmult_ristretto255_base(r)
+ self.assertEqual(p1,p2)
+
+ def test_crypto_core_ristretto255_scalar_negate(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ s = pysodium.crypto_core_ristretto255_scalar_random()
+ r = pysodium.crypto_core_ristretto255_scalar_negate(s)
+ # s + neg(s) = 0 mod L
+ s_r = pysodium.crypto_core_ristretto255_scalar_add(s,r)
+ self.assertEqual(s_r,b"\x00"*32)
+
+ def test_crypto_core_ristretto255_scalar_complement(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ x = pysodium.crypto_core_ristretto255_scalar_random()
+ x_ = pysodium.crypto_core_ristretto255_scalar_complement(x)
+ # x + complement(x) = 1 mod L
+ one = pysodium.crypto_core_ristretto255_scalar_add(x,x_)
+ self.assertEqual(one,b'\x01'+b"\x00"*31)
+
+ def test_crypto_core_ristretto255_scalar_mul(self):
+ if not pysodium.sodium_version_check(1, 0, 18): return
+ two = b'\x02' + b'\x00' * 31
+ four_mul = pysodium.crypto_core_ristretto255_scalar_mul(two,two)
+ four_add = pysodium.crypto_core_ristretto255_scalar_add(two,two)
+ self.assertEqual(four_mul,four_add)
+
+ x = pysodium.crypto_core_ristretto255_scalar_random()
+ one = b'\x01' + b'\x00' * 31
+ r = pysodium.crypto_core_ristretto255_scalar_mul(x,one)
+ self.assertEqual(x,r)
+
if __name__ == '__main__':
unittest.main()
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.12.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.12.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.12.egg-info/top_level.txt
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.0.post0.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.0.post0.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pysodium-0.7.0.post0.egg-info/top_level.txt
No differences were encountered in the control files