https://github.com/soenneker/soenneker.hashing.slhdsa
A utility library for SLH-DSA post-quantum hashing and verification
https://github.com/soenneker/soenneker.hashing.slhdsa
csharp dotnet dsa encrypt hash hashing key post-quantum private public slh slhdsa slhdsahashingutil util
Last synced: about 2 months ago
JSON representation
A utility library for SLH-DSA post-quantum hashing and verification
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.hashing.slhdsa
- Owner: soenneker
- License: mit
- Created: 2024-12-10T14:11:08.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-12T22:53:00.000Z (about 2 months ago)
- Last Synced: 2025-04-14T23:07:56.503Z (about 2 months ago)
- Topics: csharp, dotnet, dsa, encrypt, hash, hashing, key, post-quantum, private, public, slh, slhdsa, slhdsahashingutil, util
- Language: C#
- Homepage: https://soenneker.com
- Size: 373 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.hashing.slhdsa/)
[](https://github.com/soenneker/soenneker.hashing.slhdsa/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.hashing.slhdsa/)#  Soenneker.Hashing.Slhdsa
### A utility library for SLH-DSA post-quantum hashing and verificationA 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
```csharp
(string privateKey, string publicKey) = SlhDsaHashingUtil.GenerateKeyPair(); // Keys are Base64 strings
```### 2. Sign the payload with the private key
```csharp
string signature = SlhDsaHashingUtil.SignMessage("Hello, SLH-DSA!", privateKey); // Signaure is a Base64 string
```### 3. Verify the signature with the public key
```csharp
bool isValid = SlhDsaHashingUtil.VerifySignature("Hello, SLH-DSA!", signature, publicKey);
```### How to specify the optional parameter set:
```csharp
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);
```