0 branches
Tree Top files
Code
Clone with HTTPS:
56 years ago
..
base_test.v all: super_batch3 fixes last Apr 13 6.71 KB
const.c.v all: super_batch3 fixes last Apr 13 4.14 KB

slhdsa

Experimental module of NIST FIPS-205 Stateless Hash-Based Digital Signature Standard (SLH-DSA) in V

About

SLH-DSA was a quantum resistent cryptographic digital signature standard that was approved and publicly published by NIST at August, 2024. Its availables on NIST FIPS 205. SLH-DSA allow builds relatively big signaturue size with small key (16 - 32 bytes key). The signatures range from ±8K - ±50K depending on the type chosen.

[!NOTE]
This module wraps and written on top of SLH-DSA functionality availables on latest release of recent OpenSSL library. Based on the history, this functionality was added in OpenSSL 3.5. So, make sure, you have required version of OpenSSL library installed. For simple guides how to build and install latest OpenSSL library on unix-like box, see install-latest-ssl.md

Basic

SLH-DSA signature scheme is constructed using other hash-based signature schemes as components. SLH-DSA was comes with set of predefined parameter that describes security categories, ie:


import x.crypto.slhdsa

fn main() {
    // you can choose and pass the kind of the SLH-DSA parameter to the constructor
    opt := slhdsa.KeyOpts{
        kind: .sha2_128s
        // other options was availables
    }
    mut pv := slhdsa.PrivateKey.new(opt)!

    // Example message
    msg := 'SLH-DSA example message'.bytes()

    // Sign a message using constructed key
    sig := pv.sign(msg)!

    // Then the public key part can verify this signature
    mut pb := pv.public_key()!
    verified := pb.verify(sig, msg)!
    assert verified // true

    // release the resource
    pv.free()
    pb.free()
}