A Python wrapper for the libmceliece microlibrary
Project description
pymceliece
A Python wrapper for the libmceliece microlibrary
Installation
Dependencies
pymceliece depends only on libmceliece (which also depends on libcpucycles and librandombytes), available here
API
Instantiated parameters
The API follows the libmceliece API. It implements the following parameter sets:
- mceliece8192128
- mceliece6960119
- mceliece6688128
- mceliece8192128
- mceliece460896
- mceliece348864
- mceliece6960119f
- mceliece6688128f
- mceliece8192128f
- mceliece460896f
- mceliece348864f
Each has the following constants defined:
- mceliecexxxxxxx.PUBLICKEYBYTES Length of the public key
- mceliecexxxxxxx.SECRETKEYBYTES Length of the private key
- mceliecexxxxxxx.CIPHERTEXTBYTES Length of the ciphertext
- mceliecexxxxxxx.BYTES Length of the session key
Usage
For each instantiation the following functions are available:
mcelieceXXXXXXX.keypair() -> Tuple[bytes, bytes]
Randomly generates a McEliece secret key and its corresponding public key.
Example:
>>> from pymceliece import mceliece6960119
>>> pk, sk = mceliece6960119.keypair()
mcelieceXXXXXXX.enc(pk: bytes) -> Tuple[bytes, bytes]
Randomly generates a ciphertext and the corresponding session key given a public key pk.
Example:
>>> from pymceliece import mceliece8192128f
>>> pk, _ = mceliece8192128f.keypair()
>>> c, k = mceliece8192128f.enc(pk)
mcelieceXXXXXXX.dec(c: bytes, pk: bytes) -> bytes
Given a McEliece secret key sk and a ciphertext c encapsulated to sk's corresponding public key pk, computes the session key k.
Example:
>>> from pymceliece import mceliece348864f
>>> pk, sk = mceliece348864f.keypair()
>>> c, k = mceliece348864f.enc(pk)
>>> mceliece348864f.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 pymceliece-0.0.3.tar.gz.
File metadata
- Download URL: pymceliece-0.0.3.tar.gz
- Upload date:
- Size: 250.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62370f3199798a689d9ab564ad73e715926cbb6d46e39c97a54f3c6717eb2627
|
|
| MD5 |
81f28a35303b256d52452b0a5ad6290d
|
|
| BLAKE2b-256 |
382ba7a7de54587bbc528fca03132f3da514969b9d1928367a87def0acfca479
|
File details
Details for the file pymceliece-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pymceliece-0.0.3-py3-none-any.whl
- Upload date:
- Size: 306.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8bfcac8ae3a562b84d3ea7e0b2400905bcb068528afda9cfc1d98d52d32fa9b
|
|
| MD5 |
1e99dd361ef0daead1e5ec35cb46ea5f
|
|
| BLAKE2b-256 |
0bda120ab92eed17b75ccc071858f458cf4083234d58c0fe01dfc57a4866c153
|