Skip to main content

Python bindings for SPHINCS+

Project description

PySPX SPHINCS Python Bindings

This repository contains a Python package that provides bindings for SPHINCS+. It provides support for all parameter sets included as part of the SPHINCS+ submission to NIST's Post-Quantum Cryptography Standardization project.

While this package is functionally complete, it may still be subject to small API changes. Currently, the bindings only wrap the reference code. Code optimized for specific platforms (such as machines with AVX2 or AESNI support) is ignored.

Installation

The package is available on PyPI and can be installed by simply calling pip install pyspx.

For Linux, binary wheels are available based on the manylinux1 docker image. On other platforms it may take a few moments to compile the SPHINCS+ code. Currently the sphincsplus reference code requires openssl for its SHA256 function. When compiling from source, be sure to install openssl with development files.

API

After installing the package, import a specific instance of SPHINCS+ as follows (e.g. for shake256-128f):

import pyspx.shake256_128f

This exposes the following straight-forward functions. All parameters are assumed to be bytes objects. Similarly, the returned keys and signatures are bytes. The verify function returns a boolean indicating success or failure.

>>> public_key, secret_key = pyspx.shake256_128f.generate_keypair(seed)
>>> signature = pyspx.shake256_128f.sign(message, secret_key)
>>> pyspx.shake256_128f.verify(message, signature, public_key)
True

Additionally, the following attributes expose the expected sizes, as a consequence of the selected parameter set:

>>> pyspx.shake256_128f.crypto_sign_BYTES
29792
>>> pyspx.shake256_128f.crypto_sign_PUBLICKEYBYTES
64
>>> pyspx.shake256_128f.crypto_sign_SECRETKEYBYTES
128
>>> pyspx.shake256_128f.crypto_sign_SEEDBYTES
96

Custom SPHINCS+ parameters

It is fairly easy to compile with additional SPHINCS+ parameters. To do this, clone the repository, initialize the src/sphincsplus submodule, and add a new parameter set to src/sphincsplus/ref/params. Make sure to follow the params-sphincs-[parameters-shorthand].h naming convention. Installing the Python package from this modified source will expose the parameter set using the API described above.

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

PySPX-0.5.0.tar.gz (454.4 kB view details)

Uploaded Source

Built Distributions

PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.28+ x86-64

File details

Details for the file PySPX-0.5.0.tar.gz.

File metadata

  • Download URL: PySPX-0.5.0.tar.gz
  • Upload date:
  • Size: 454.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for PySPX-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e3544229e2bee9ef13a8468693491374080beb3f91080c3a86c698be8ece2baa
MD5 13e2e5972069836eed152d3a89b97554
BLAKE2b-256 98d52a5a52edc715e0cb3b3b1d6f67668b9f07775e2ec19c63742552780e1c6f

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aa64aa0e2aa523a6a4484a2721d33694147730d0910493aa23bf1f452f4fba45
MD5 5810e1c16ff6b8b8e3f853d01fce2a5c
BLAKE2b-256 b7d2cf1bdd5b20fe3a93c11fc9cd80d2590ca0ee806f9f81610889dc3cc33596

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f0f0500e57c1191f8bfa8592a5d0ebfa7a8c3fa4754547daddf72f369572b591
MD5 6a0c57be4c10cbe4f46822b4d444ec49
BLAKE2b-256 fb4be7645331e508346bc879261ccf24a8cb88d9257f7b49bb4b3571852f55fd

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 84cd7837a417d2d5b19a7cf23e15e3d0aaa196c7bec7baf3e09323160c6360a5
MD5 653a5ae7fd7f7f040a58106991b9078c
BLAKE2b-256 8e1dc845c0a610f6fd28e6bc5b8bde156bdb3f5629f7a8f287a56d28b539adc9

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e1216877f718fa679200929aa31072ba7310f1e62de7247b0e4a241956b7570
MD5 40a3692ad71c56ecbe9893869c04f885
BLAKE2b-256 94e49e68beb36f1d968a785e3c237b593c335a5998476c4c6e4430b453cf53d3

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f635225a4f367b120128b6fc4b7615b63d808fefc8d0e728eafa14b6d5423109
MD5 f162991972025cb9593a3b7989ff204c
BLAKE2b-256 3db1c27465b96e10b7e21d35bb2675d8b0da698ce821271fb7aa03d0a263cd97

See more details on using hashes here.

File details

Details for the file PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a492790ef3b3db126c5915eab190f19fc07a89961a2fb02c35b70e5098dba4a3
MD5 80a294db2214bf3d5f3dcf83fcf0542e
BLAKE2b-256 0fc397a9432ee37d6018c11c2f073a490b66b1ecbdae8023c9a0f2fd1f77c62c

See more details on using hashes here.

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