Skip to main content

The pure python impl of the slh-das algorithm(based on fips205).

Project description

SLH-DSA

Test And Build codecov PyPI - Downloads GitHub License

The SLH-DSA project implements the stateless-hash digital signing algorithm(standardizing fips 205, adopted on Sphincs-Plus algorithm) in pure Python.

This project offers those future:

  1. 🍻 Zero dependencies;
  2. 🏷️ 100% type hint for all the codes;
  3. ✅ Extreme good 98% test coverage;
  4. 🔖 Support any newer python version!
  5. ⚒️ Design for Human!
  6. :tada: More futures coming soon!

The functionality is extremely simple to use, as demonstrated by the following example:

from slhdsa import KeyPair, shake_256f, PublicKey

kp = KeyPair.gen(shake_256f)  # generate the keypair
sig = kp.sign(b"Hello World!")  # sign the message
kp.verify(b"Hello World!", sig)  # -> True
kp.verify(b"Hello World!", b"I'm the hacker!") # -> False
kp.verify(b"hello world!", sig)  # -> False
sig = kp.sign(b"Hello World!", randomize = True)  # sign the message randomized
kp.verify(b"Hello World!", sig)  # -> True

digest = kp.pub.digest()  # generate the digest of the public key so that other device could verify the sign
pub = PublicKey.from_digest(digest)  # generate public key
pub.verify(b"Hello World!", sig)  # -> True
pub.verify(b"Hello World", sig)  # -> False

Copyright

Copyright(c) Colinxu2020 2024 All Rights Reserved.

This software is licensed under GNU Lesser General Public License Version 3 or later(on your option).

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

slh_dsa-0.1.3.tar.gz (255.8 kB view hashes)

Uploaded Source

Built Distribution

slh_dsa-0.1.3-py3-none-any.whl (26.0 kB view hashes)

Uploaded Python 3

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