A Python wrapper for the libntruprime microlibrary
Project description
pyntruprime
A Python wrapper for the libntruprime microlibrary
Installation
Dependencies
pyntruprime depends only on libntruprime (which also depends on libcpucycles and librandombytes), available here
API
Instantiated parameters
The API follows the libntruprime API. It implements the following parameter sets:
- sntrup761
More parameter sets may be added later
Each has the following constants defined:
- sntrup761.PUBLICKEYBYTES Length of the public key
- sntrup761.SECRETKEYBYTES Length of the private key
- sntrup761.CIPHERTEXTBYTES Length of the ciphertext
- sntrup761.BYTES Length of the session key
Usage
For each instantiation the following functions are available:
sntrup761.keypair() -> Tuple[bytes, bytes]
Randomly generates a NTRUprime secret key and its corresponding public key.
Example:
>>> from pyntruprime import sntrup761
>>> pk, sk = sntrup761.keypair()
sntrup761.enc(pk: bytes) -> Tuple[bytes, bytes]
Randomly generates a ciphertext and the corresponding session key given a public key pk.
Example:
>>> from pyntruprime import sntrup761
>>> pk, _ = sntrup761.keypair()
>>> c, k = sntrup761.enc(pk)
sntrup761.dec(c: bytes, pk: bytes) -> bytes
Given a NTRUprime secret key sk and a ciphertext c encapsulated to sk's corresponding public key pk, computes the session key k.
Example:
>>> from pyntruprime import sntrup761
>>> pk, sk = sntrup761.keypair()
>>> c, k = sntrup761.enc(pk)
>>> sntrup761.dec(c, sk) == k
True
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
Built Distribution
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 pyntruprime-0.0.3.tar.gz.
File metadata
- Download URL: pyntruprime-0.0.3.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb3714497cb9306a6e5e30ceb28a6d8ec57e53e1a14fc7aec7d4e743aae0ad79
|
|
| MD5 |
f0a86825286a16f74251991277949474
|
|
| BLAKE2b-256 |
b041efc35b61a1dc11864d07b5c120366ff8ca4cf73d543de85959c0fb08d869
|
File details
Details for the file pyntruprime-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pyntruprime-0.0.3-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1b459da9c673d48aac990ae51391cfe20204e73bfe7c22a11640c8e0a8d0b2f
|
|
| MD5 |
081fae0aff8be826205559c23715fc03
|
|
| BLAKE2b-256 |
4f585cb80ff5789d93a34ea2247585b7fb91ce040cade68ad0fcb285bf3b9937
|