Python library that provides wrappers around the Ristretto group operations in libsodium.
Project description
rbcl
Ristretto group Python binding to libsodium
rbcl supports Python 3.7, 3.8 and 3.9.
from rbcl import *
x = crypto_core_ristretto255_random()
assert crypto_core_ristretto255_is_valid_point(x)
y = crypto_core_ristretto255_from_hash(b'\xF0'*64)
assert crypto_core_ristretto255_is_valid_point(y)
z1 = crypto_core_ristretto255_add(x, y)
z2 = crypto_core_ristretto255_add(y, x)
assert z1 == z2 # Assert that point addition commutes (in L)
s1 = crypto_core_ristretto255_scalar_random()
s2 = crypto_core_ristretto255_scalar_random()
w1 = crypto_scalarmult_ristretto255(s1, crypto_scalarmult_ristretto255(s2, x))
w2 = crypto_scalarmult_ristretto255(s2, crypto_scalarmult_ristretto255(s1, x))
assert w1 == w2 # Assert that point multiplication (by a scalar) is repeated addition (in L)
The following bindings are made available:
Constructors
crypto_core_ristretto255_random()
crypto_core_ristretto255_from_hash(h)
crypto_core_ristretto255_is_valid_point(p)
Scalar arithmetic
crypto_core_ristretto255_scalar_add(s1, s2)
crypto_core_ristretto255_scalar_sub(s1, s2)
crypto_core_ristretto255_scalar_mul(s1, s2) # NOT scalar mulitplication of a point!
crypto_core_ristretto255_scalar_complement(s)
crypto_core_ristretto255_scalar_invert(s)
crypto_core_ristretto255_scalar_negate(s)
crypto_core_ristretto255_scalar_reduce(s)
crypto_core_ristretto255_scalar_random()
Point arithmetic
crypto_core_ristretto255_add(p, q)
crypto_core_ristretto255_sub(p, q)
crypto_scalarmult_ristretto255(p, s)
crypto_scalarmult_ristretto255_base(s)
Constants
crypto_scalarmult_ristretto255_bytes crypto_scalarmult_ristretto255_scalarbytes crypto_core_ristretto255_bytes crypto_core_ristretto255_scalarbytes crypto_core_ristretto255_hashbytes crypto_core_ristretto255_nonreducedscalarbytes
Helpers
randombytes randombytes_buf_deterministic
Manual installation
# Build as a wheel and install
python setup.py bdist_wheel
python -m pip install -f wheelhouse --no-index rbcl
python -m nose
Publishing (for Maintainers Only)
# Package source distribution
python setup.py sdist
# Run wheel-builder.yml and save/download artifacts locally, e.g. in ./dist
# Then, upload to PyPi
twine upload dist/rbcl-0.2.0*
Documentation
The documentation can be generated automatically from the source files using Sphinx:
cd docs python -m pip install -r requirements.txt sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../setup.py ../rbcl/sodium_ffi.py && make html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rbcl-0.2.0.tar.gz
(9.9 kB
view hashes)
Built Distributions
rbcl-0.2.0-cp36-abi3-win_amd64.whl
(102.9 kB
view hashes)
rbcl-0.2.0-cp36-abi3-win32.whl
(94.6 kB
view hashes)
Close
Hashes for rbcl-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61c1bf35c89741a4bd37f1c5aa34e6b3cf7c77aa54f93a2e131ee781a1c649b7 |
|
MD5 | 17ada3d0672fc3e2c4b7a0e39e809bd7 |
|
BLAKE2b-256 | 33a3837986863468c958535f83dc611d0098da8ed8a6d2bf7db5993deffb1047 |
Close
Hashes for rbcl-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2b4643b4ca64d8692735600089a45254a0a4ef3f9a83eeecdf25813245d1244 |
|
MD5 | 76e6c4fbcbf428298e8eb5b1b534c886 |
|
BLAKE2b-256 | 199a2d1218b39dd4f57b0376a562e2cf71d906ecb21f2ef30de5c3a7859b2241 |
Close
Hashes for rbcl-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34de45c4f3df13d84b502848e3bbfd74bbb9dced3d77c824fefcf15d6f4e2f78 |
|
MD5 | 8bb7fdcd035060ece14a80c6f96dc574 |
|
BLAKE2b-256 | 2994970099ec8c07d5f2afc55e4dd9682e9878ab6e55ee5ff9191d6164597003 |
Close
Hashes for rbcl-0.2.0-cp36-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6029d0d81dddfbb729558f92634204d7f997e9ba61d6cd57cbb17cca43e9b838 |
|
MD5 | e0e0c4fdcee47e0ff8f16257c37a4c67 |
|
BLAKE2b-256 | af80d72075adaca384430f7d9997c2c084df1e2d873ca41e6f80efc9b0ac000a |
Close
Hashes for rbcl-0.2.0-cp36-abi3-macosx_10_10_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da97fedb8f53033c8e9d712034f0c8694b6c79e709a3ec3bd2920ef89f3bdd7 |
|
MD5 | b9188c72f58e508aa2db59f260efef44 |
|
BLAKE2b-256 | b59619f53e735a3e86e058b9ed2a344b5308a591a63ec78201a9eb71596606c6 |
Close
Hashes for rbcl-0.2.0-cp36-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 769d6f7193c76495a2f80ceff29a21f620e69ab29ab88f09e408fb54fa5dde22 |
|
MD5 | fd226f0e495d395ed93937cbadbf055a |
|
BLAKE2b-256 | ceb7c32e9ec113422b717d622d679bab540a7301ee7beb26c4e17ad6d29c9e8c |
Close
Hashes for rbcl-0.2.0-cp36-abi3-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4484cdd98b6a962f668b1c6ff5e4164a1dc64602c4d93b9211bb4a22090e81aa |
|
MD5 | 5437646f77e01c909d9809c5e4390066 |
|
BLAKE2b-256 | b0abd4278397b390e000dfb2231dbeaa15d22e3321674750c60d00b734b7d267 |