Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymceliece-0.0.2.tar.gz (250.2 kB view details)

Uploaded Source

Built Distribution

pymceliece-0.0.2-py3-none-any.whl (305.8 kB view details)

Uploaded Python 3

File details

Details for the file pymceliece-0.0.2.tar.gz.

File metadata

  • Download URL: pymceliece-0.0.2.tar.gz
  • Upload date:
  • Size: 250.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pymceliece-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3e2bd7048b9f3ba576df6a0782ec15ebc9b6be669148adf4831109c139e26e91
MD5 00f87c8dc011b2008c66042ad0d625bc
BLAKE2b-256 4452aa65129a62f0eb7a81855a4cd25ab9409fdf6e1242fd2eac0fb0ec6f7468

See more details on using hashes here.

Provenance

File details

Details for the file pymceliece-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pymceliece-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 305.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pymceliece-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e8884fe83328e3c7e8ab6e343fdf6babaa72142c9ee9d23d3210e7afecd92d1a
MD5 0d7b953ed44ee96dd75d9ed3c235af96
BLAKE2b-256 8b838e9d2fd3f14fd4934bdbcc52c9856ac3807b68563287a6b78d62a8cc1b4f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page