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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rbcl-0.1.8-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 598.5 kB
- Tags: CPython 3.9+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3d73cfdb38ef88a9779bcf54f100b3feac72f9b75491bd503e6853c42d339e7
|
|
| MD5 |
a1bfd600a9476061570baa3486629fc8
|
|
| BLAKE2b-256 |
d8647f39e7ef8f45f336bdf0031059c68dd450d5bbcb084814b504bf91cecf23
|
File details
Details for the file rbcl-0.1.8-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 598.9 kB
- Tags: CPython 3.8+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a69423dcc4a8d896e26826581edc488a8a4cea3ae175d9f796f1d5a501d8d9f
|
|
| MD5 |
ebe2c2a272f49e5337bd039d46960523
|
|
| BLAKE2b-256 |
22cfa05460cc1f10a74a7b2b7aea0097976c43a9850c98fbde8d66ca2be2bfbf
|
File details
Details for the file rbcl-0.1.8-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 598.2 kB
- Tags: CPython 3.7+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
224b511f33e2566c1b95e3ce9272878b054ec4228e385755adb0619abb1b18ef
|
|
| MD5 |
9b8636ccf0765479d9c5cd12b31e27f4
|
|
| BLAKE2b-256 |
b026533e8f3255d90ffe68a015218322b97c2d768716b313e0686ac40d997754
|
File details
Details for the file rbcl-0.1.8-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp36-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 598.2 kB
- Tags: CPython 3.6+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46cea90f4114dc8a1e824918da042667ae3f55a414adbd371f3ed00adcd3adc6
|
|
| MD5 |
6be77ac8a2ffa5f61385b473d67b8147
|
|
| BLAKE2b-256 |
2078a2254403841a19fa83ff6f55af2570f980b3c3f4695421ed3396c9124953
|
File details
Details for the file rbcl-0.1.8-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp35-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 598.1 kB
- Tags: CPython 3.5+, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081bf82f51a2b93d141c04e5e3f23c84f4d06fc36ef63186704adf6ffac1de39
|
|
| MD5 |
1a19ee318f9edaea99ed3b2d00c7f15b
|
|
| BLAKE2b-256 |
9048d4b4e0d78e2fafa762fcfeff57ba71e717b5d017aebd41e8cfca980f5074
|
File details
Details for the file rbcl-0.1.8-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 601.5 kB
- Tags: CPython 2.7mu, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
458e89010427a8c0405bcdb47af4037d7692308e7e29538fdb24de793a21c701
|
|
| MD5 |
9aba051ccf2c7c927e8932f99b6a9fd1
|
|
| BLAKE2b-256 |
e276f8033146ee2b5b289b9b10bc4d67be263954aa478616a3360885ca0b209a
|
File details
Details for the file rbcl-0.1.8-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: rbcl-0.1.8-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 601.5 kB
- Tags: CPython 2.7m, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f392a56f2c4d090ed521e688540e205df3b5ec9de5b13fcb4a54905916477ad
|
|
| MD5 |
3cb97d4e0ba44395c2596fb88e5de513
|
|
| BLAKE2b-256 |
0c8ce19b9aaea121bde3eb3e03989ed2bd946ba067d5552e0b27810104e6ad54
|