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*
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 && 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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for rbcl-0.1.8-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3d73cfdb38ef88a9779bcf54f100b3feac72f9b75491bd503e6853c42d339e7 |
|
MD5 | a1bfd600a9476061570baa3486629fc8 |
|
BLAKE2b-256 | d8647f39e7ef8f45f336bdf0031059c68dd450d5bbcb084814b504bf91cecf23 |
Close
Hashes for rbcl-0.1.8-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a69423dcc4a8d896e26826581edc488a8a4cea3ae175d9f796f1d5a501d8d9f |
|
MD5 | ebe2c2a272f49e5337bd039d46960523 |
|
BLAKE2b-256 | 22cfa05460cc1f10a74a7b2b7aea0097976c43a9850c98fbde8d66ca2be2bfbf |
Close
Hashes for rbcl-0.1.8-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 224b511f33e2566c1b95e3ce9272878b054ec4228e385755adb0619abb1b18ef |
|
MD5 | 9b8636ccf0765479d9c5cd12b31e27f4 |
|
BLAKE2b-256 | b026533e8f3255d90ffe68a015218322b97c2d768716b313e0686ac40d997754 |
Close
Hashes for rbcl-0.1.8-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46cea90f4114dc8a1e824918da042667ae3f55a414adbd371f3ed00adcd3adc6 |
|
MD5 | 6be77ac8a2ffa5f61385b473d67b8147 |
|
BLAKE2b-256 | 2078a2254403841a19fa83ff6f55af2570f980b3c3f4695421ed3396c9124953 |
Close
Hashes for rbcl-0.1.8-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081bf82f51a2b93d141c04e5e3f23c84f4d06fc36ef63186704adf6ffac1de39 |
|
MD5 | 1a19ee318f9edaea99ed3b2d00c7f15b |
|
BLAKE2b-256 | 9048d4b4e0d78e2fafa762fcfeff57ba71e717b5d017aebd41e8cfca980f5074 |
Close
Hashes for rbcl-0.1.8-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 458e89010427a8c0405bcdb47af4037d7692308e7e29538fdb24de793a21c701 |
|
MD5 | 9aba051ccf2c7c927e8932f99b6a9fd1 |
|
BLAKE2b-256 | e276f8033146ee2b5b289b9b10bc4d67be263954aa478616a3360885ca0b209a |
Close
Hashes for rbcl-0.1.8-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f392a56f2c4d090ed521e688540e205df3b5ec9de5b13fcb4a54905916477ad |
|
MD5 | 3cb97d4e0ba44395c2596fb88e5de513 |
|
BLAKE2b-256 | 0c8ce19b9aaea121bde3eb3e03989ed2bd946ba067d5552e0b27810104e6ad54 |