[Python-modules-commits] [pysodium] 01/12: import pysodium_0.6.11.orig.tar.gz

Christopher Stuart Hoskin mans0954 at moszumanska.debian.org
Tue Jun 6 09:03:29 UTC 2017


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

mans0954 pushed a commit to branch master
in repository pysodium.

commit 1cb66110fc63152c596842144276128576fb9a0a
Author: Christopher Hoskin <mans0954 at debian.org>
Date:   Tue Jun 6 07:52:15 2017 +0100

    import pysodium_0.6.11.orig.tar.gz
---
 AUTHORS                                |  16 +
 MANIFEST.in                            |   2 +
 PKG-INFO                               | 149 ++++++++
 README.md                              | 133 +++++++
 pysodium.egg-info/PKG-INFO             | 149 ++++++++
 pysodium.egg-info/SOURCES.txt          |  11 +
 pysodium.egg-info/dependency_links.txt |   1 +
 pysodium.egg-info/top_level.txt        |   2 +
 pysodium/__init__.py                   | 662 +++++++++++++++++++++++++++++++++
 setup.cfg                              |   4 +
 setup.py                               |  28 ++
 test/__init__.py                       |   7 +
 test/test_pysodium.py                  | 307 +++++++++++++++
 13 files changed, 1471 insertions(+)

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..1fdeb5c
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,16 @@
+Stefan Marsiske s at ctrlc.hu
+Bulat Gaifullin
+Maximilian Heß
+J Bell
+Cale Black
+Jan Varho
+Henri Sivonen
+Wes Young
+namelessjon
+Emmanuel Vadot
+Kevin DeLoach
+Andreas Bogk
+Fredrick Brennan
+iachievedit
+Tacitus Aedifex
+venzen
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..9a42db3
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+include README.md
+include AUTHORS
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..8a90293
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,149 @@
+Metadata-Version: 1.1
+Name: pysodium
+Version: 0.6.11
+Summary: python libsodium wrapper
+Home-page: https://github.com/stef/pysodium
+Author: Stefan Marsiske
+Author-email: s at 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_auth(message, key)
+        crypto_auth(tag, message, key)
+        crypto_auth_verify(h, m, k=b'')
+        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_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_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_NONCEBYTES
+        crypto_aead_chacha20poly1305_ietf_KEYBYTES
+        crypto_aead_chacha20poly1305_ietf_NONCEBYTES
+        crypto_auth_BYTES
+        crypto_auth_KEYBYTES
+        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_BYTES
+        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_pwhash_ALG_DEFAULT
+        crypto_pwhash_MEMLIMIT_INTERACTIVE
+        crypto_pwhash_MEMLIMIT_MODERATE
+        crypto_pwhash_MEMLIMIT_SENSITIVE
+        crypto_pwhash_OPSLIMIT_INTERACTIVE
+        crypto_pwhash_OPSLIMIT_MODERATE
+        crypto_pwhash_OPSLIMIT_SENSITIVE
+        crypto_pwhash_SALTBYTES
+        crypto_pwhash_STRBYTES
+        crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+        crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+        crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+        crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+        crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+        crypto_pwhash_scryptsalsa208sha256_STRBYTES
+        crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+        crypto_scalarmult_BYTES
+        crypto_scalarmult_curve25519_BYTES
+        crypto_secretbox_BOXZEROBYTES
+        crypto_secretbox_KEYBYTES
+        crypto_secretbox_KEYBYTES
+        crypto_secretbox_MACBYTES
+        crypto_secretbox_NONCEBYTES
+        crypto_secretbox_ZEROBYTES
+        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
+        ```
+        
+        
+        
+        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
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..325c01e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,133 @@
+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_auth(message, key)
+crypto_auth(tag, message, key)
+crypto_auth_verify(h, m, k=b'')
+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_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_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_NONCEBYTES
+crypto_aead_chacha20poly1305_ietf_KEYBYTES
+crypto_aead_chacha20poly1305_ietf_NONCEBYTES
+crypto_auth_BYTES
+crypto_auth_KEYBYTES
+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_BYTES
+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_pwhash_ALG_DEFAULT
+crypto_pwhash_MEMLIMIT_INTERACTIVE
+crypto_pwhash_MEMLIMIT_MODERATE
+crypto_pwhash_MEMLIMIT_SENSITIVE
+crypto_pwhash_OPSLIMIT_INTERACTIVE
+crypto_pwhash_OPSLIMIT_MODERATE
+crypto_pwhash_OPSLIMIT_SENSITIVE
+crypto_pwhash_SALTBYTES
+crypto_pwhash_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+crypto_pwhash_scryptsalsa208sha256_STRBYTES
+crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+crypto_scalarmult_BYTES
+crypto_scalarmult_curve25519_BYTES
+crypto_secretbox_BOXZEROBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_KEYBYTES
+crypto_secretbox_MACBYTES
+crypto_secretbox_NONCEBYTES
+crypto_secretbox_ZEROBYTES
+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
+```
+
+
+
+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/PKG-INFO b/pysodium.egg-info/PKG-INFO
new file mode 100644
index 0000000..8a90293
--- /dev/null
+++ b/pysodium.egg-info/PKG-INFO
@@ -0,0 +1,149 @@
+Metadata-Version: 1.1
+Name: pysodium
+Version: 0.6.11
+Summary: python libsodium wrapper
+Home-page: https://github.com/stef/pysodium
+Author: Stefan Marsiske
+Author-email: s at 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_auth(message, key)
+        crypto_auth(tag, message, key)
+        crypto_auth_verify(h, m, k=b'')
+        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_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_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_NONCEBYTES
+        crypto_aead_chacha20poly1305_ietf_KEYBYTES
+        crypto_aead_chacha20poly1305_ietf_NONCEBYTES
+        crypto_auth_BYTES
+        crypto_auth_KEYBYTES
+        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_BYTES
+        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_pwhash_ALG_DEFAULT
+        crypto_pwhash_MEMLIMIT_INTERACTIVE
+        crypto_pwhash_MEMLIMIT_MODERATE
+        crypto_pwhash_MEMLIMIT_SENSITIVE
+        crypto_pwhash_OPSLIMIT_INTERACTIVE
+        crypto_pwhash_OPSLIMIT_MODERATE
+        crypto_pwhash_OPSLIMIT_SENSITIVE
+        crypto_pwhash_SALTBYTES
+        crypto_pwhash_STRBYTES
+        crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+        crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+        crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+        crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+        crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+        crypto_pwhash_scryptsalsa208sha256_STRBYTES
+        crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+        crypto_scalarmult_BYTES
+        crypto_scalarmult_curve25519_BYTES
+        crypto_secretbox_BOXZEROBYTES
+        crypto_secretbox_KEYBYTES
+        crypto_secretbox_KEYBYTES
+        crypto_secretbox_MACBYTES
+        crypto_secretbox_NONCEBYTES
+        crypto_secretbox_ZEROBYTES
+        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
+        ```
+        
+        
+        
+        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
diff --git a/pysodium.egg-info/SOURCES.txt b/pysodium.egg-info/SOURCES.txt
new file mode 100644
index 0000000..c8ae154
--- /dev/null
+++ b/pysodium.egg-info/SOURCES.txt
@@ -0,0 +1,11 @@
+AUTHORS
+MANIFEST.in
+README.md
+setup.py
+pysodium/__init__.py
+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/dependency_links.txt b/pysodium.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pysodium.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/pysodium.egg-info/top_level.txt b/pysodium.egg-info/top_level.txt
new file mode 100644
index 0000000..e91f29c
--- /dev/null
+++ b/pysodium.egg-info/top_level.txt
@@ -0,0 +1,2 @@
+pysodium
+test
diff --git a/pysodium/__init__.py b/pysodium/__init__.py
new file mode 100755
index 0000000..a7ee0e0
--- /dev/null
+++ b/pysodium/__init__.py
@@ -0,0 +1,662 @@
+#!/usr/bin/env python2
+"""
+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.
+"""
+
+import ctypes
+import ctypes.util
+
+sodium = ctypes.cdll.LoadLibrary(ctypes.util.find_library('sodium') or ctypes.util.find_library('libsodium'))
+if not sodium._name:
+    raise ValueError('Unable to find libsodium')
+
+sodium.sodium_version_string.restype = ctypes.c_char_p
+
+try:
+    sodium_major = int(sodium.sodium_version_string().decode('utf8').split('.')[0])
+    sodium_minor = int(sodium.sodium_version_string().decode('utf8').split('.')[1])
+    sodium_patch = int(sodium.sodium_version_string().decode('utf8').split('.')[2])
+except (IndexError, ValueError):
+    raise ValueError('Unable to parse version string from libsodium')
+
+def sodium_version_check(major, minor, patch):
+    """Check if the current libsodium version is greater or equal to the supplied one
+    """
+    if major > sodium_major:
+        return False
+    if major == sodium_major and minor > sodium_minor:
+        return False
+    if major == sodium_major and minor == sodium_minor and patch > sodium_patch:
+        return False
+    return True
+
+def sodium_version(major, minor, patch):
+    def decorator(func):
+        def wrapper(*args, **kwargs):
+            if sodium_version_check(major, minor, patch) == False:
+                raise ValueError('Unavailable in this libsodium version')
+            return func(*args, **kwargs)
+        return wrapper
+    return decorator
+
+def encode_strings(func):
+    """
+    This decorator forces the encoding of str function parameters to UTF-8
+    to elliminate the differences between Python 3.x and Python 2.x. The only
+    caveat is that bytes and str are both str types in Python 2.x so it is
+    possible for the encode() function to fail. It is OK for us to accept that
+    failure, hence the pass in the except block.
+
+    Use this decorator on any functions that can take strings as parameters
+    such as crypto_pwhash().
+    """
+    def wrapper(*args, **kwargs):
+        largs = []
+        for arg in args:
+            if isinstance(arg, str):
+                try:
+                    arg = arg.encode(encoding='utf-8')
+                except:
+                    pass
+            largs.append(arg)
+        for k in kwargs.keys():
+            if isinstance(kwargs[k], str):
+                try:
+                    kwargs[k] = kwargs[k].encode(encoding='utf-8')
+                except:
+                    pass
+        return func(*largs, **kwargs)
+    return wrapper
+
+sodium.crypto_pwhash_scryptsalsa208sha256_strprefix.restype = ctypes.c_char_p
+
+crypto_auth_KEYBYTES = sodium.crypto_auth_keybytes()
+crypto_auth_BYTES = sodium.crypto_auth_bytes()
+crypto_box_NONCEBYTES = sodium.crypto_box_noncebytes()
+crypto_box_PUBLICKEYBYTES = sodium.crypto_box_publickeybytes()
+crypto_box_SECRETKEYBYTES = sodium.crypto_box_secretkeybytes()
+crypto_box_ZEROBYTES = sodium.crypto_box_zerobytes()
+crypto_box_BOXZEROBYTES = sodium.crypto_box_boxzerobytes()
+crypto_box_MACBYTES = sodium.crypto_box_macbytes()
+crypto_box_SEALBYTES = sodium.crypto_box_sealbytes()
+crypto_box_SEEDBYTES = sodium.crypto_box_seedbytes()
+crypto_secretbox_KEYBYTES = sodium.crypto_secretbox_keybytes()
+crypto_secretbox_NONCEBYTES = sodium.crypto_secretbox_noncebytes()
+crypto_secretbox_ZEROBYTES = sodium.crypto_secretbox_zerobytes()
+crypto_secretbox_BOXZEROBYTES = sodium.crypto_secretbox_boxzerobytes()
+crypto_secretbox_MACBYTES = sodium.crypto_secretbox_macbytes()
+crypto_sign_PUBLICKEYBYTES = sodium.crypto_sign_publickeybytes()
+crypto_sign_SECRETKEYBYTES = sodium.crypto_sign_secretkeybytes()
+crypto_sign_SEEDBYTES = sodium.crypto_sign_seedbytes()
+crypto_sign_BYTES = sodium.crypto_sign_bytes()
+crypto_sign_ed25519_SECRETKEYBYTES = sodium.crypto_sign_ed25519_secretkeybytes()
+crypto_sign_ed25519_PUBLICKEYBYTES = sodium.crypto_sign_ed25519_publickeybytes()
+crypto_stream_KEYBYTES = sodium.crypto_stream_keybytes()
+crypto_stream_NONCEBYTES = sodium.crypto_stream_noncebytes()
+crypto_generichash_BYTES = sodium.crypto_generichash_bytes()
+crypto_scalarmult_curve25519_BYTES = sodium.crypto_scalarmult_curve25519_bytes()
+crypto_scalarmult_BYTES = sodium.crypto_scalarmult_bytes()
+crypto_generichash_blake2b_KEYBYTES_MAX = sodium.crypto_generichash_blake2b_keybytes_max()
+crypto_generichash_blake2b_BYTES = sodium.crypto_generichash_blake2b_bytes()
+crypto_generichash_blake2b_BYTES_MIN = sodium.crypto_generichash_blake2b_bytes_min()
+crypto_generichash_blake2b_BYTES_MAX = sodium.crypto_generichash_blake2b_bytes_max()
+crypto_generichash_blake2b_SALTBYTES = sodium.crypto_generichash_blake2b_saltbytes()
+crypto_generichash_blake2b_PERSONALBYTES = sodium.crypto_generichash_blake2b_personalbytes()
+crypto_pwhash_scryptsalsa208sha256_SALTBYTES = sodium.crypto_pwhash_scryptsalsa208sha256_saltbytes()
+crypto_pwhash_scryptsalsa208sha256_STRBYTES = sodium.crypto_pwhash_scryptsalsa208sha256_strbytes()
+crypto_pwhash_scryptsalsa208sha256_STRPREFIX = sodium.crypto_pwhash_scryptsalsa208sha256_strprefix()
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE = sodium.crypto_pwhash_scryptsalsa208sha256_opslimit_interactive()
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE = sodium.crypto_pwhash_scryptsalsa208sha256_memlimit_interactive()
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE = sodium.crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive()
+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_aead_chacha20poly1305_KEYBYTES = sodium.crypto_aead_chacha20poly1305_keybytes()
+crypto_aead_chacha20poly1305_NONCEBYTES = sodium.crypto_aead_chacha20poly1305_npubbytes()
+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_NONCEBYTES = sodium.crypto_aead_chacha20poly1305_ietf_npubbytes()
+    crypto_pwhash_SALTBYTES = sodium.crypto_pwhash_saltbytes()
+    crypto_pwhash_STRBYTES = sodium.crypto_pwhash_strbytes()
+    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()
+    crypto_pwhash_MEMLIMIT_MODERATE = sodium.crypto_pwhash_memlimit_moderate()
+    crypto_pwhash_OPSLIMIT_SENSITIVE = sodium.crypto_pwhash_opslimit_sensitive()
+    crypto_pwhash_MEMLIMIT_SENSITIVE = sodium.crypto_pwhash_memlimit_sensitive()
+    crypto_pwhash_ALG_DEFAULT = sodium.crypto_pwhash_alg_default()
+else:
+    crypto_pwhash_ALG_DEFAULT = None
+
+class CryptoGenericHashState(ctypes.Structure):
+    _pack_ = 1
+    _fields_ = [
+        ('h', ctypes.c_uint64 * 8),
+        ('t', ctypes.c_uint64 * 2),
+        ('f', ctypes.c_uint64 * 2),
+        ('buf', ctypes.c_uint8 * 2 * 128),
+        ('buflen', ctypes.c_size_t),
+        ('last_node', ctypes.c_uint8)
+    ]
+
+
+def __check(code):
+    if code != 0:
+        raise ValueError
+
+
+def pad_buf(buf, length, name = 'buf'):
+    buflen = len(buf)
+    if buflen > length:
+        raise ValueError("Cannot pad %s (len: %d - expected %d or less)" % (name, buflen, length))
+
+    padding = length - buflen
+    if padding > 0:
+        return buf + b"\x00"*padding
+    else:
+        return buf
+
+def crypto_scalarmult_curve25519(n, p):
+    buf = ctypes.create_string_buffer(crypto_scalarmult_BYTES)
+    __check(sodium.crypto_scalarmult_curve25519(buf, n, p))
+    return buf.raw
+
+
+def crypto_scalarmult_curve25519_base(n):
+    if n is None:
+        raise ValueError("invalid parameters")
+    buf = ctypes.create_string_buffer(crypto_scalarmult_BYTES)
+    __check(sodium.crypto_scalarmult_curve25519_base(ctypes.byref(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)
+def crypto_stream_chacha20_xor(message, nonce, key):
+
+    mlen = ctypes.c_longlong(len(message))
+
+    c = ctypes.create_string_buffer(len(message))
+
+    __check(sodium.crypto_stream_chacha20_xor(c, message, mlen, nonce, 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):
+
+    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 + 16)
+    clen = ctypes.c_ulonglong(0)
+
+    __check(sodium.crypto_aead_chacha20poly1305_encrypt(c, ctypes.byref(clen), message, mlen, ad, adlen, None, nonce, key))
+    return c.raw
+
+
+# crypto_aead_chacha20poly1305_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
+def crypto_aead_chacha20poly1305_decrypt(ciphertext, ad, nonce, key):
+
+    m = ctypes.create_string_buffer(len(ciphertext) - 16)
+    mlen = ctypes.c_ulonglong(0)
+    clen = ctypes.c_ulonglong(len(ciphertext))
+    adlen = ctypes.c_ulonglong(len(ad)) if ad is not None else ctypes.c_ulonglong(0)
+    __check(sodium.crypto_aead_chacha20poly1305_decrypt(m, ctypes.byref(mlen), None, ciphertext, clen, ad, adlen, nonce, key))
+    return m.raw
+
+# crypto_aead_chacha20poly1305_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)
+ at sodium_version(1, 0, 9)
+def crypto_aead_chacha20poly1305_encrypt_detached(message, ad, nonce, key):
+    """ Return ciphertext, mac tag """
+    
+    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_ABYTES)
+    mac = ctypes.create_string_buffer(maclen_p.value)    
+
+    __check(sodium.crypto_aead_chacha20poly1305_encrypt_detached(c, mac, ctypes.byref(maclen_p), message, mlen, ad, adlen, None, nonce, key))
+    return c.raw, mac.raw
+
+# crypto_aead_chacha20poly1305_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)
+ at sodium_version(1, 0, 9)
+def crypto_aead_chacha20poly1305_decrypt_detached(ciphertext, mac, ad, nonce, key):
+    """ Return message if successful or -1 (ValueError) if not successful"""
+    
+    if len(mac) != crypto_aead_chacha20poly1305_ABYTES:
+        raise ValueError("mac length != %i" % crypto_aead_chacha20poly1305_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_decrypt_detached(m, None, ciphertext, clen, mac, ad, adlen, nonce, key))
+    return m.raw
+    
+# crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c, unsigned long long *clen_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)
+ at sodium_version(1, 0, 4)
+def crypto_aead_chacha20poly1305_ietf_encrypt(message, ad, nonce, 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 + 16)
+    clen = ctypes.c_ulonglong(0)
+
+    __check(sodium.crypto_aead_chacha20poly1305_ietf_encrypt(c, ctypes.byref(clen), message, mlen, ad, adlen, None, nonce, key))
+    return c.raw
+
+# crypto_aead_chacha20poly1305_ietf_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
+ at sodium_version(1, 0, 4)
+def crypto_aead_chacha20poly1305_ietf_decrypt(ciphertext, ad, nonce, key):
+
+    m = ctypes.create_string_buffer(len(ciphertext) - 16)
+    mlen = ctypes.c_ulonglong(0)
+    clen = ctypes.c_ulonglong(len(ciphertext))
+    adlen = ctypes.c_ulonglong(len(ad)) if ad is not None else ctypes.c_ulonglong(0)
+    __check(sodium.crypto_aead_chacha20poly1305_ietf_decrypt(m, ctypes.byref(mlen), None, ciphertext, clen, ad, adlen, 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:
+        raise ValueError("invalid parameters")
+    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:
+        raise ValueError("invalid parameters")
+    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)
+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))))
+    return buf.raw
+
+
+# crypto_generichash_init(crypto_generichash_state *state, const unsigned char *key, const size_t keylen, const size_t outlen);
+def crypto_generichash_init(outlen=crypto_generichash_BYTES, k=b''):
+    state = CryptoGenericHashState()
+    __check(sodium.crypto_generichash_init(ctypes.byref(state), k, ctypes.c_size_t(len(k)), ctypes.c_size_t(outlen)))
+    return state
+
+
+# crypto_generichash_update(crypto_generichash_state *state, const unsigned char *in, unsigned long long inlen);
+def crypto_generichash_update(state, m):
+    assert isinstance(state, CryptoGenericHashState)
+    __check(sodium.crypto_generichash_update(ctypes.byref(state), m, ctypes.c_ulonglong(len(m))))
+    return state
+
+
+# crypto_generichash_final(crypto_generichash_state *state, unsigned char *out, const size_t outlen);
+def crypto_generichash_final(state, outlen=crypto_generichash_BYTES):
+    assert isinstance(state, CryptoGenericHashState)
+    buf = ctypes.create_string_buffer(outlen)
+    __check(sodium.crypto_generichash_final(ctypes.byref(state), buf, ctypes.c_size_t(outlen)))
+    return buf.raw
+
+def crypto_generichash_blake2b_salt_personal(message, outlen = crypto_generichash_blake2b_BYTES, key = b'', salt = b'', personal = b''):
+    keylen   = len(key)
+
+    if keylen != 0 and not crypto_generichash_blake2b_BYTES_MIN <= keylen <= crypto_generichash_blake2b_KEYBYTES_MAX:
+        raise ValueError("%d <= len(key) <= %d - %d recieved" % (crypto_generichash_blake2b_BYTES_MIN, crypto_generichash_blake2b_KEYBYTES_MAX, keylen))
+
+    salt     = pad_buf(salt, crypto_generichash_blake2b_SALTBYTES, 'salt')
+    personal = pad_buf(personal, crypto_generichash_blake2b_PERSONALBYTES, 'personal')
+
+    buf      = ctypes.create_string_buffer(outlen)
+    outlen   = ctypes.c_size_t(outlen)
+    inlen    = ctypes.c_ulonglong(len(message))
+    keylen   = ctypes.c_size_t(keylen)
+
+    __check(sodium.crypto_generichash_blake2b_salt_personal(buf, outlen, message, inlen, key, keylen, salt, personal))
+    return buf.raw
+
+
+def randombytes(size):
+    buf = ctypes.create_string_buffer(size)
+    sodium.randombytes(buf, ctypes.c_ulonglong(size))
+    return buf.raw
+
+
+def crypto_box_keypair():
+    pk = ctypes.create_string_buffer(crypto_box_PUBLICKEYBYTES)
+    sk = ctypes.create_string_buffer(crypto_box_SECRETKEYBYTES)
+    __check(sodium.crypto_box_keypair(pk, sk))
+    return pk.raw, sk.raw
+
+# int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
+#                                const unsigned char *seed);
+def crypto_box_seed_keypair(seed):
+    if seed is None:
+        raise ValueError("invalid parameters")
+    pk = ctypes.create_string_buffer(crypto_box_PUBLICKEYBYTES)
+    sk = ctypes.create_string_buffer(crypto_box_SECRETKEYBYTES)
+    __check(sodium.crypto_box_seed_keypair(pk, sk, seed))
+    return pk.raw, sk.raw
+
+def crypto_box_beforenm(pk, sk):
+    if pk is None or sk is None:
+        raise ValueError("invalid parameters")
+    c = ctypes.create_string_buffer(crypto_secretbox_KEYBYTES)
+    __check(sodium.crypto_box_beforenm(c, pk, sk))
+    return c.raw
+
+def crypto_box(msg, nonce, pk, sk):
+    if None in (msg, nonce, pk, sk):
+        raise ValueError("invalid parameters")
+    c = ctypes.create_string_buffer(crypto_box_MACBYTES + len(msg))
+    __check(sodium.crypto_box_easy(c, msg, ctypes.c_ulonglong(len(msg)), nonce, pk, sk))
+    return c.raw
+
+def crypto_box_afternm(msg, nonce, k):
+    if None in (msg, nonce, k):
+        raise ValueError("invalid parameters")
+    c = ctypes.create_string_buffer(crypto_box_MACBYTES + len(msg))
+    __check(sodium.crypto_box_easy_afternm(c, msg, ctypes.c_ulonglong(len(msg)), nonce, k))
+    return c.raw
+
+def crypto_box_open(c, nonce, pk, sk):
+    if None in (c, nonce, pk, sk):
+        raise ValueError("invalid parameters")
+    msg = ctypes.create_string_buffer(len(c) - crypto_box_MACBYTES)
+    __check(sodium.crypto_box_open_easy(msg, c, ctypes.c_ulonglong(len(c)), nonce, pk, sk))
+    return msg.raw
+
+def crypto_box_open_afternm(c, nonce, k):
+    if None in (c, nonce, k):
+        raise ValueError("invalid parameters")
+    msg = ctypes.create_string_buffer(len(c) - crypto_box_MACBYTES)
+    __check(sodium.crypto_box_open_easy_afternm(msg, c, ctypes.c_ulonglong(len(c)), nonce, k))
+    return msg.raw
+
+def crypto_secretbox(msg, nonce, k):
+    if None in (msg, nonce, k):
+        raise ValueError("invalid parameters")
+    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))
+    return c.raw[crypto_secretbox_BOXZEROBYTES:]
+
+
+def crypto_secretbox_open(c, nonce, k):
+    if None in (c, nonce, k):
+        raise ValueError("invalid parameters")
+    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))
+    return msg.raw[crypto_secretbox_ZEROBYTES:]
+
+# int crypto_box_seal(unsigned char *c, const unsigned char *m,
+#                    unsigned long long mlen, const unsigned char *pk);
+
+ at sodium_version(1, 0, 3)
+def crypto_box_seal(msg, k):
+    if msg is None or k is None:
+        raise ValueError("invalid parameters")
+    c = ctypes.create_string_buffer(len(msg)+crypto_box_SEALBYTES)
+    __check(sodium.crypto_box_seal(c, msg, ctypes.c_ulonglong(len(msg)), k))
+    return c.raw
+
+# int crypto_box_seal_open(unsigned char *m, const unsigned char *c,
+#                         unsigned long long clen,
+#                         const unsigned char *pk, const unsigned char *sk);
+
+ at sodium_version(1, 0, 3)
+def crypto_box_seal_open(c, pk, sk):
+    if None in (c, pk, sk):
+        raise ValueError("invalid parameters")
+    msg = ctypes.create_string_buffer(len(c)-crypto_box_SEALBYTES)
+    __check(sodium.crypto_box_seal_open(msg, c, ctypes.c_ulonglong(len(c)), pk, sk))
+    return msg.raw
+
+
+# int crypto_box_detached(unsigned char *c, unsigned char *mac,
+#                        const unsigned char *m, unsigned long long mlen,
+#                        const unsigned char *n, const unsigned char *pk,
+#                        const unsigned char *sk);
+
+def crypto_box_detached(msg, nonce, pk, sk):
+        if None in (msg, nonce, pk, sk):
+            raise ValueError("invalid parameters")
+        c = ctypes.create_string_buffer(len(msg))
+        mac = ctypes.create_string_buffer(crypto_box_MACBYTES)
+        __check(sodium.crypto_box_detached(c, mac, msg.encode(), ctypes.c_ulonglong(len(msg)), nonce, pk, sk))
+        return c.raw, mac.raw
+
+# int crypto_box_open_detached(unsigned char *m, const unsigned char *c,
+#                             const unsigned char *mac,
+#                             unsigned long long clen,
+#                             const unsigned char *n,
+#                             const unsigned char *pk,
+#                             const unsigned char *sk);
... 571 lines suppressed ...

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



More information about the Python-modules-commits mailing list