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 multiplication 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(s, p)
crypto_scalarmult_ristretto255_allow_scalar_zero(s, p)
crypto_scalarmult_ristretto255_base(s)
crypto_scalarmult_ristretto255_base_allow_scalar_zero(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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rbcl-0.3.1.tar.gz.
File metadata
- Download URL: rbcl-0.3.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed6952ec2c471bc0005e43a35638849abbf45831e559aba15ef8c21b65ca1849
|
|
| MD5 |
31dd25ac536319c610e9a54a74ca8a80
|
|
| BLAKE2b-256 |
1650a9b2385951639ee744ee46770bc022afe0bce4ff722659ea4852aa639aa9
|
File details
Details for the file rbcl-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rbcl-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 713.0 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
107b6d64daa51a650335e27aca8cbba7f8f4155c3ea05ca1c75550169839dae2
|
|
| MD5 |
aa801ce3b2bafa796044209d0ff3c1c3
|
|
| BLAKE2b-256 |
9dc5c21c26a8ee563dbe27ba6be1282525258774addca992fb92e4daebfaf8a8
|
File details
Details for the file rbcl-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rbcl-0.3.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 713.3 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74094f8bdfc4b4f89372901c519fab9a1b7a96d1d3b66b7cdd535a30290b8787
|
|
| MD5 |
58e372ae18ae0b19ce6cefe82dfe3321
|
|
| BLAKE2b-256 |
6ac867bc8f765dc0a3f92ff59fc3b73cc0e3d6b10260725d28044328d928f557
|
File details
Details for the file rbcl-0.3.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rbcl-0.3.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 712.7 kB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
606ab32f41213e3d9d2e475f26db5e68aaf49cbd1857463bd69fb2fd0bc540f8
|
|
| MD5 |
4cab5f560a605af94bf71c53a5f34897
|
|
| BLAKE2b-256 |
6b3910dd6a57a67df1e29c64c7be4bcd3ae455f5b443bf5aa124902133cf1569
|
File details
Details for the file rbcl-0.3.1-cp36-abi3-win_amd64.whl.
File metadata
- Download URL: rbcl-0.3.1-cp36-abi3-win_amd64.whl
- Upload date:
- Size: 102.8 kB
- Tags: CPython 3.6+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc30986ca1bef316974879f3bf9e711b56d42b198e1c816b600cedf857ba6989
|
|
| MD5 |
e6d484102eaf34515bdca1717d3ea20d
|
|
| BLAKE2b-256 |
f6c942dc950c897a05546ae72c81f13ee828e76d2a84e1a715a7403fb9d308b1
|
File details
Details for the file rbcl-0.3.1-cp36-abi3-win32.whl.
File metadata
- Download URL: rbcl-0.3.1-cp36-abi3-win32.whl
- Upload date:
- Size: 94.8 kB
- Tags: CPython 3.6+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9585d8b62a50537a2b87f0bb6d1d04abcba827f90dc2170b057768efe98d54f1
|
|
| MD5 |
9f10799437bc1c005dd81c2b53b22a7c
|
|
| BLAKE2b-256 |
d5a5d2bb63900b96b5ab3842e3c8d26fea261eae5b98ddfa50a418ad3a4a47a3
|
File details
Details for the file rbcl-0.3.1-cp36-abi3-macosx_10_10_universal2.whl.
File metadata
- Download URL: rbcl-0.3.1-cp36-abi3-macosx_10_10_universal2.whl
- Upload date:
- Size: 173.4 kB
- Tags: CPython 3.6+, macOS 10.10+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e7432cd5c43f495595f06c79642cbcef245c69f66c2e8a0e679e1cc7788632d
|
|
| MD5 |
308044a3da702d3792ad8255cfc40d86
|
|
| BLAKE2b-256 |
43e91241f463a05707f910a6fe0b2d1a213d7dab02d509499cad91aee3f33ef7
|
File details
Details for the file rbcl-0.3.1-cp36-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: rbcl-0.3.1-cp36-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 240.3 kB
- Tags: CPython 3.6+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5b4b46028c54e28df813d5a58a6b54d739da5278530658b00143260406842e3
|
|
| MD5 |
36bb8646bf9c926218997b3439983d9b
|
|
| BLAKE2b-256 |
8d3181f8f412e6504296901138d397f5eba3a6bda9b7f2013c3a1e13b08b0549
|