Skip to content

soenneker/soenneker.hashing.slhdsa

Repository files navigation

Soenneker.Hashing.Slhdsa

A utility library for SLH-DSA post-quantum hashing and verification

A compact and lightweight library for SLH-DSA (Stateless Hash-Based Digital Signature Algorithm), a post-quantum cryptographic standard providing robust security against classical and quantum attacks. SLH-DSA uses hash-based cryptography to ensure secure key generation, message signing, and signature verification.

Features

  • Generate SLH-DSA key pairs.
  • Sign and verify messages.
  • Supports multiple parameter sets (e.g., SHAKE-128F, SHA2-128F).
  • Thread-safe supporting concurrency.
  • Tests included.

Installation

dotnet add package Soenneker.Hashing.Slhdsa

Usage

1. Generate a public and private key pair

(string privateKey, string publicKey) = SlhDsaHashingUtil.GenerateKeyPair(); // Keys are Base64 strings

2. Sign the payload with the private key

string signature = SlhDsaHashingUtil.SignMessage("Hello, SLH-DSA!", privateKey); // Signaure is a Base64 string

3. Verify the signature with the public key

bool isValid = SlhDsaHashingUtil.VerifySignature("Hello, SLH-DSA!", signature, publicKey);

How to specify the optional parameter set:

var parameterSet = SlhDsaParameterType.SLH_DSA_SHAKE_128F;

(string privateKey, string publicKey) = SlhDsaHashingUtil.GenerateKeyPair(parameterSet);
string signature = SlhDsaHashingUtil.SignMessage("Hello, SLH-DSA!", privateKey, parameterSet);
bool isValid = SlhDsaHashingUtil.VerifySignature("Hello, SLH-DSA!", signature, publicKey, parameterSet);

About

A utility library for SLH-DSA post-quantum hashing and verification

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •  

Languages