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.6.tar.gz
(45.1 MB
view hashes)
Built Distributions
rbcl-0.1.6-cp35-abi3-win_amd64.whl
(112.8 kB
view hashes)
rbcl-0.1.6-cp35-abi3-win32.whl
(105.1 kB
view hashes)
Close
Hashes for rbcl-0.1.6-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 605c24a07962504787908bc4ff3047a300c1d6a6ead3eb3fe279f0c9493bb042 |
|
MD5 | 6f9f0da4cbd4f7b443e6fa7e0df77f67 |
|
BLAKE2b-256 | 50a595cce37b456b2c0a74bd49147b695e2a7be8f43331a929fbdaeebc6b5476 |
Close
Hashes for rbcl-0.1.6-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0fd7f8b5390702f1dc6be66fd2ed2f394ea171aa2c875174abfa9e68dc7d781 |
|
MD5 | faaa7815aa2d241636de1a00868dae83 |
|
BLAKE2b-256 | ef6283c2956094b923ac37b7f397ce5981b96907ed2bdec75350a7e03a810a49 |
Close
Hashes for rbcl-0.1.6-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0409198364475e2473f9e12de12b38205253b661515b46275ddf206834981c98 |
|
MD5 | 2a75d9ada5bad0cda6aec5a4b0ef05b1 |
|
BLAKE2b-256 | 52d6fc0a961880964e093fb2d21effbc5d7fe1d6577eb66d11b74157a8f0be88 |
Close
Hashes for rbcl-0.1.6-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06c796834e45bc0d26b9d576f63e2536f7e4933dcc6a6573a30880b3dc6f9693 |
|
MD5 | fbe380d5a23b3f60d77f5933f6218492 |
|
BLAKE2b-256 | 1df3818c67166ab99be6a08188b6b85e9fc461141cfd180797d64218f8663c41 |
Close
Hashes for rbcl-0.1.6-cp35-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b728f7b3a1eb433863cf30756587cd0307def3b8c048e65fcfdfe28d23e877 |
|
MD5 | cf17090bdc28f4b5735ae5aaba7de180 |
|
BLAKE2b-256 | 7e6b018948b3aaa4be76e887adf5b74f3721075df59f5a0b2474a454ad939654 |
Close
Hashes for rbcl-0.1.6-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4475711a35b45e373bdf790c9c4956bccc217cd2d0381e61349c785121d2cea2 |
|
MD5 | 1e610c135ea58d730cb82057c5448f8b |
|
BLAKE2b-256 | 8133f7bde5d730a77a24ca9839c9e81cf6548394ae9ab59254db907ced4ed696 |
Close
Hashes for rbcl-0.1.6-cp35-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4b27ce60bc46732d4d04c3853fd89eb5e85ad2e703717aa765c3493897808f9 |
|
MD5 | d994cf6ca68644f7f7024f8bd7b31be8 |
|
BLAKE2b-256 | 7d6181b64e2f19663dbfa2d8a695db15b9800115ad6602200edc511f6ee9d8b7 |
Close
Hashes for rbcl-0.1.6-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 658648f9b11728a8e9c51f1d1be934879a6eaa98d8c19215908793f2219e5817 |
|
MD5 | 8fc4c708a0b09ae78d9b6e159bb25ebf |
|
BLAKE2b-256 | 034953c461b8fc7814dd07874316d7bf5c398254263b908ad402e9b6d8642916 |
Close
Hashes for rbcl-0.1.6-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 883eac274956ad3f328cab867d066c5bb066b58b02db51dab7e020434be86f5f |
|
MD5 | 4bb985c3421b79f0c82d2c5d41aa5d17 |
|
BLAKE2b-256 | f9ee42befcf2a0fdffc164f154c9b2d2ec75689c47d0db15a4cf50e64178a70b |