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 --force-reinstall dist/rbcl-*.whl
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.1.tar.gz
(2.0 MB
view hashes)
Built Distributions
rbcl-0.1.1-cp35-abi3-win_amd64.whl
(112.7 kB
view hashes)
rbcl-0.1.1-cp35-abi3-win32.whl
(105.0 kB
view hashes)
Close
Hashes for rbcl-0.1.1-cp39-cp39-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33a0fa2275bef78de74afb29ee9aec085bf148e30770d3e420a24b3cfb672657 |
|
MD5 | e5da5d1e47677faaa6c52907c2504ebc |
|
BLAKE2b-256 | 1d52361cf8d0ca4401bb971123b371aa7b225f1291d067f74c487be5c41d22b5 |
Close
Hashes for rbcl-0.1.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 020c9bf4381905e7dd4016f3b5487ef65fb88f4db1a4491126b996403bad75a0 |
|
MD5 | b41440be2ca0288e068741a35453f229 |
|
BLAKE2b-256 | eeacef90639096443e4c75cdfab767870e6eda4edad0190d699046d72047bcf9 |
Close
Hashes for rbcl-0.1.1-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de6a1ae6a905b6931da4ebc45ff4623c029cc69e28923c961b09ba7da69ba853 |
|
MD5 | 0074fe9be49397d52f254f301261faea |
|
BLAKE2b-256 | 47696d14c255efd41b348295ece212051b0e7bead9d0a89797eccc7bd286edf6 |
Close
Hashes for rbcl-0.1.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f84fc935a5b3e2a11e372cd4e5130eb5f4ea3495bc600b930da3903fff38f81 |
|
MD5 | 4c44f2185e47e3493c656ef0ee0f032d |
|
BLAKE2b-256 | 24922bbbf4b580c407153c3ee76218d1e782d37f7e866901cb940dc0192856ea |
Close
Hashes for rbcl-0.1.1-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a65c4e59ace073b6c338fdebecb918ed1be72abe87f5b2e022059b8cb140453 |
|
MD5 | d03e55528470d5560c6b299046f64827 |
|
BLAKE2b-256 | 855c5be911faad31ed3d2d62ffdc4cee6f5417c4692e4c527b4b14aec3be22b6 |
Close
Hashes for rbcl-0.1.1-cp35-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 517c8062949965ea0b232b463d674114bb3d0e61e155bdc759a71977f6161dd1 |
|
MD5 | 214f0fa6198cb54869cb314c4f8e4277 |
|
BLAKE2b-256 | a7c94c36c6266d1d77afda273e10ee09e15e257ee712548600454df7017a1e7a |
Close
Hashes for rbcl-0.1.1-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11a08c0ef29d7bc68106e3e6897fd8c37479842ed1411a31103a6cbae7efb47c |
|
MD5 | 1bbe482a8cb684a2864a6d74a79f4271 |
|
BLAKE2b-256 | 47c699f2249f61d6e0acfc4e88f824edc716e3653feaf4ea5d65250cce617694 |
Close
Hashes for rbcl-0.1.1-cp35-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4322289e7b1d726801910788e7b252d928d5984abc4555f3c80a701ee7edc43b |
|
MD5 | f23cd8c0fd9d263b8cb7059a16ef1fc3 |
|
BLAKE2b-256 | d22ab4a0a456448d331bfdfdfebebbcdc50a29a9e9ff4e65248e3447d37035d1 |
Close
Hashes for rbcl-0.1.1-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92bce244a043fd7bb664371efdfbd7266528ebc4396015c58680eedc91902e82 |
|
MD5 | 9f2b66f094da19af252329747c1482c1 |
|
BLAKE2b-256 | ec7fc28c7ba151935fb8b42ed40407957bed61957ffc7991f1fd8d0c4d33b7c2 |
Close
Hashes for rbcl-0.1.1-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98cd8b3ed5d283140cc96b15f572b1868be3a5db39f0cd35a110954075962e0b |
|
MD5 | cb5aa4accc0ebcf089e1d647d80dd536 |
|
BLAKE2b-256 | 5351ab5be5b52ea3e1fc2a03cb98366bef26e2b6de191b43bfe6a4f9fd60fb0e |