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.2.tar.gz
(45.0 MB
view hashes)
Built Distributions
rbcl-0.1.2-cp35-abi3-win_amd64.whl
(112.9 kB
view hashes)
rbcl-0.1.2-cp35-abi3-win32.whl
(105.1 kB
view hashes)
Close
Hashes for rbcl-0.1.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d99f7af5c9c0fde19e3fa73359e8dbbef8ac5c800c8d6553926c53eee08118 |
|
MD5 | 30dd70c1c6ed4b7b38d04e8241280d29 |
|
BLAKE2b-256 | 8059d5367285086a49ee1331b1f07ce4269d400a0d0f3c77584e732318d45d55 |
Close
Hashes for rbcl-0.1.2-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167a80725429142badfcc4c644dd262dcae84327503e895182ff95efc3a3d9a6 |
|
MD5 | e49a3d820be1388b7175ce7b943ae507 |
|
BLAKE2b-256 | 0beae1f7088d82c9dd6c94aa0a8ac7f9c677ebe614c6429e53e0c07562b84381 |
Close
Hashes for rbcl-0.1.2-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74c782b85c7d2d27a9c5bf12da94646328b60627bf25aea967268f62cada117d |
|
MD5 | 03053f9bb1b8c14c28e8e24f2aa23034 |
|
BLAKE2b-256 | 7c917dcf0be4cb23d08f7870e27b074f7f6485a902ebc3e717473477ff38921a |
Close
Hashes for rbcl-0.1.2-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a244a312d8d69e197250b62722ece7f22f1a124f9b73c47a477036d05751700d |
|
MD5 | 4d987fe31e08f82f6923f576430bf82d |
|
BLAKE2b-256 | ad3cde6ed4d0b3b68cef32e9abb487c12b64a0cc2095214dd12862502b50b7ab |
Close
Hashes for rbcl-0.1.2-cp35-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b479054c2211ab330e25f38c69e782beed9f0e471b888da40913d3716ff87943 |
|
MD5 | 90bd174d6b32c73e8b384850a36c738f |
|
BLAKE2b-256 | 83f26529d8ce1b5b4c5d415210329b96fecf0ffb3b9d41c2f85de11873a3014a |
Close
Hashes for rbcl-0.1.2-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ec0c85584aed9e8e1c13ea7343d167bbb94388f1715b097878531593e2679d7 |
|
MD5 | 435ff8763edc2335c8c0a6c0142a8a9f |
|
BLAKE2b-256 | a2c42ad3ef4026aff4c9d7dee3e748df3c22e26cd1f88d48c7fae78bff7d3724 |
Close
Hashes for rbcl-0.1.2-cp35-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c3e57ee036034869a409c19605df6c9d7863ed1451e75295030d9f0fd7d8c68 |
|
MD5 | dcaba25d34207e7fc814b46b3876e984 |
|
BLAKE2b-256 | ddfe05ddb97039b15eb411b71dfdf2cca015007087dfae3e4c984cb35f6579c2 |
Close
Hashes for rbcl-0.1.2-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cfc8309deb652156afe03b04e0b47119d74d0669d65d85468e9b8c947903ae2 |
|
MD5 | cb63829e1f98c689dfc730056f8a18f0 |
|
BLAKE2b-256 | ee7847529ab0674c3323cd2fcd0f427eea72c6f1bb86360c1f5e1b9c21d24fe0 |
Close
Hashes for rbcl-0.1.2-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af2ff12aa764dbc223e8068502837b4652e6f14a9a8eaf2e96f8d7d8ed6226e7 |
|
MD5 | 57424145f763184c594a9d07ecc895c3 |
|
BLAKE2b-256 | 1655ce2bb463604b4f5a993503a521d438a68e65b2d4964a98604f4e519de46c |