Skip to main content

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.

Metadata

Release files for PySPX 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PySPX 0.5.0
File Size Uploaded
PySPX-0.5.0.tar.gz 454.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for PySPX 0.5.0
File
PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details
PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 8.8 MB

Release files / PySPX-0.5.0.tar.gz

Download URL PySPX-0.5.0.tar.gz
Size 454.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e3544229e2bee9ef13a8468693491374080beb3f91080c3a86c698be8ece2baa
BLAKE2b-256 checksum
How to use checksums
98d52a5a52edc715e0cb3b3b1d6f67668b9f07775e2ec19c63742552780e1c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
aa64aa0e2aa523a6a4484a2721d33694147730d0910493aa23bf1f452f4fba45
BLAKE2b-256 checksum
How to use checksums
b7d2cf1bdd5b20fe3a93c11fc9cd80d2590ca0ee806f9f81610889dc3cc33596
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f0f0500e57c1191f8bfa8592a5d0ebfa7a8c3fa4754547daddf72f369572b591
BLAKE2b-256 checksum
How to use checksums
fb4be7645331e508346bc879261ccf24a8cb88d9257f7b49bb4b3571852f55fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
84cd7837a417d2d5b19a7cf23e15e3d0aaa196c7bec7baf3e09323160c6360a5
BLAKE2b-256 checksum
How to use checksums
8e1dc845c0a610f6fd28e6bc5b8bde156bdb3f5629f7a8f287a56d28b539adc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6e1216877f718fa679200929aa31072ba7310f1e62de7247b0e4a241956b7570
BLAKE2b-256 checksum
How to use checksums
94e49e68beb36f1d968a785e3c237b593c335a5998476c4c6e4430b453cf53d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f635225a4f367b120128b6fc4b7615b63d808fefc8d0e728eafa14b6d5423109
BLAKE2b-256 checksum
How to use checksums
3db1c27465b96e10b7e21d35bb2675d8b0da698ce821271fb7aa03d0a263cd97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl

Download URL PySPX-0.5.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a492790ef3b3db126c5915eab190f19fc07a89961a2fb02c35b70e5098dba4a3
BLAKE2b-256 checksum
How to use checksums
0fc397a9432ee37d6018c11c2f073a490b66b1ecbdae8023c9a0f2fd1f77c62c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.5.0 This release

7 release files

0.4.0

7 release files

0.3.0

13 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page