Python binding to the Ristretto group operations in NaCl.
Project description
RbCl
Ristretto group Python binding to libsodium
RbCl supports Python 2.7 and 3.5+ as well as PyPy 2.6+.
import rbcl.bindings as lib
x = lib.crypto_core_ristretto255_random()
assert lib.crypto_core_ristretto255_is_valid_point(x)
y = lib.crypto_core_ristretto255_from_hash(b'\xF0'*64)
assert lib.crypto_core_ristretto255_is_valid_point(y)
z1 = lib.crypto_core_ristretto255_add(x, y)
z2 = lib.crypto_core_ristretto255_add(y, x)
assert z1 == z2 # Assert that point addition commutes (in L)
s1 = lib.crypto_core_ristretto255_scalar_random()
s2 = lib.crypto_core_ristretto255_scalar_random()
w1 = lib.crypto_scalarmult_ristretto255(s1, lib.crypto_scalarmult_ristretto255(s2, x))
w2 = lib.crypto_scalarmult_ristretto255(s2, lib.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 sodium_bin2hex sodium_hex2bin sodium_base642bin sodium_base64_encoded_len sodium_bin2base64 sodium_pad sodium_unpad
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 Nth Party]
# 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.1.1*
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.1.3.tar.gz
(45.0 MB
view hashes)
Built Distributions
rbcl-0.1.3-cp35-abi3-win_amd64.whl
(112.9 kB
view hashes)
rbcl-0.1.3-cp35-abi3-win32.whl
(105.1 kB
view hashes)
Close
Hashes for rbcl-0.1.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96b86f18355d1595f9f1e6e9ff4f2ac06614b3003c51cb91fc71e42be19f5894 |
|
MD5 | e196279ad48325a9709b68ab64fcd58e |
|
BLAKE2b-256 | 0bfeb1df0084db13c85321e7615bdfcf73d9100221ca75963389bb0cef05596c |
Close
Hashes for rbcl-0.1.3-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97e3fd24508aa70a2cb27cc01041e1f4d4f452db8ea6a186ca38a0a7da77a0b8 |
|
MD5 | a401559049a4b4c2de717f062968f5e2 |
|
BLAKE2b-256 | 4344dc1b18230b662ca588490b8d01abc516ddd0639d32edec6175e29778df49 |
Close
Hashes for rbcl-0.1.3-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 688aff6bb5ec398cfa601a28aeb347b131355a841788afa3eb41eaa503479f9d |
|
MD5 | ab279dd2be2511ba1fbb8ecb7a03b4cd |
|
BLAKE2b-256 | 3995ccd9f4989f040e96bc90b47abecc896c3f4ab22ab42fd08b2a4fed406af8 |
Close
Hashes for rbcl-0.1.3-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d33afb6f01e03ee42710200674020b50948d9822e70e037a8110727ce7350437 |
|
MD5 | dd5a93af675a7ff810ec23e65dae0039 |
|
BLAKE2b-256 | 6859d09d0e84cc55f07797d9dc223fa3d7e5e8ae23f71d673f1b78e3d6a98689 |
Close
Hashes for rbcl-0.1.3-cp35-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7a81bdc64bfb68f8a3a54f1139d01a4e62aacda536527ac7dd377e8820f53ba |
|
MD5 | 6b8a6a4be52a236185311b13407d2710 |
|
BLAKE2b-256 | 1a187282437ab537ade0671d49485bba0066c0d921c15a197f249df498fb2530 |
Close
Hashes for rbcl-0.1.3-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63986b97cd35974651e0ebe46272f816957d7dc72a7700c39147f18ba71ad775 |
|
MD5 | 52c3dd51d74744b9682e1a8765623f7d |
|
BLAKE2b-256 | 708fb08a7951402bb09ebb9da975ec1a32251ba943c6342157db52c5b9370b96 |
Close
Hashes for rbcl-0.1.3-cp35-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b324360c6295dfe397ddbd5091b78c692d1aee23273dc66f08e540fecc77ea4 |
|
MD5 | a210fcac985cb547b4d914f65d196c3e |
|
BLAKE2b-256 | af57e6ed4b8ef806e728c9dd2b90e2cfef47c93469d1dcc2f6bf600db50d8d7d |
Close
Hashes for rbcl-0.1.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 938ecd7705a4d702ce12f66383e68672f71a562dc1c466ca20fb73d41bfeeee3 |
|
MD5 | 749cd7a5404eb3151aa0c4bb5472b6d1 |
|
BLAKE2b-256 | e4602fb6b60bc777856252eef0f36f590a15d3592efd6770ad9a1d57e0c2c4ad |
Close
Hashes for rbcl-0.1.3-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9272bbe51fedb7ae5da1e0671ee9664127c7a80bc2fd3f2e78ccad9f787bd205 |
|
MD5 | 98800e56192036b1165e10ab336bc7ea |
|
BLAKE2b-256 | e4386c630021495ecc59bd83b8df7d9d3938efae9f4feede463befc77ab33a7e |