csodium is a Python 2/3 standalone interface for
csodium was started as the result of a
maintainers. They wanted the library to remain a simple wrapper (using
to dynamically load
libsodium at runtime, mainly to always use the latest
libsodium) while we wanted it to be a standalone package
that would work out of the box, especially for Windows/Mac OSX wheel users.
The goal being users should not need to install/compile
libsodium and could
pip install to get things started.
Another point of conflict is the support of Python 3.
As an attempt to make the best out of those two opinions,
initiated, which aims at providing an out-of-the-box, ready-to-use
Python interface while still giving the ability to Linux and OSX users to
recompile and/or use the latest available
libsodium if they want to.
csodium aims to be compatible with
pysodium, but there is no syncing of
any kind between the two projects as of now, so their APIs might diverge in the
csodium aims at offering the whole
libsodium API through its Python's
bindings. However, it only offers a subset at the moment (
crypto_secretbox family functions). I'm the sole contributor which explains
why this API support improves slowly. If you are interested in making things
faster, adding new functions is actually really simple and pull requests are
most welcome ! Here is the guide:
- Find the exact
Cprototype of the function you wish to add support for and add it to the
- Implement a meaningful Python version of that function in the
__init__.pymodule. You can get your inspiration from already defined function.
- Make sure you handle well incorrect input value and that you raise
appropriately on errors. See the
- Write tests that cover input failures as well as at least a successful run.
Coverage should remain at 100%. Also remember that the goal is not to test
libsodiumbut the Python binding.
- Submit your pull request !
Python 2 support on Windows
libsodium hasn't been supporting Visual Studio 2008 for a while and
this is required to make binary packages for Python 2.7 on Windows. If you know
of a simple way to compile
libsodium using Visual Studio for Python that
doesn't prevent upgrading
libsodium, please contribute !
You may install it by using
pip install csodium