From ad41d7e5b8efd08cb94196a84ece2db2aa1faf78 Mon Sep 17 00:00:00 2001 From: Donald Stufft <donald.stufft@gmail.com> Date: Thu, 21 Feb 2013 23:05:30 -0500 Subject: [PATCH] Start nacl.ffi.libsodium with the low level hashing functions --- nacl/ffi/__init__.py | 0 nacl/ffi/libsodium.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 nacl/ffi/__init__.py create mode 100644 nacl/ffi/libsodium.py diff --git a/nacl/ffi/__init__.py b/nacl/ffi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nacl/ffi/libsodium.py b/nacl/ffi/libsodium.py new file mode 100644 index 00000000..b9b35b48 --- /dev/null +++ b/nacl/ffi/libsodium.py @@ -0,0 +1,21 @@ +""" +CFFI interface to libsodium the library +""" +from cffi import FFI + +ffi = FFI() + +ffi.cdef( + # Low Level Hashing functions + """ + static const int crypto_hash_BYTES; + static const int crypto_hash_sha256_BYTES; + static const int crypto_hash_sha512_BYTES; + + int crypto_hash(unsigned char *out, const unsigned char *in, unsigned long long inlen); + int crypto_hash_sha256(unsigned char *out, const unsigned char *in, unsigned long long inlen); + int crypto_hash_sha512(unsigned char *out, const unsigned char *in, unsigned long long inlen); + """ +) + +lib = ffi.verify("#include <sodium.h>", libraries=["sodium"]) -- GitLab