x.crypto.slhdsa: add a SLH-DSA implementation, a stateless hash-based DSA, a post quantum cryptographic module (#24086)

This commit is contained in:
blackshirt 2025-04-01 18:01:26 +07:00 committed by GitHub
parent 12afd051bb
commit a8a4507237
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1513 additions and 0 deletions

View file

@ -0,0 +1,26 @@
module main
import x.crypto.slhdsa
fn main() {
// creates default key
mut pvkey := slhdsa.PrivateKey.new()!
// example of message
xmsg := 'Sample message'.bytes()
// signing the message with the key
sig := pvkey.sign(xmsg)!
// example of public key
mut pbkey := pvkey.public_key()!
// verify signature with the public key
verified := pbkey.verify(sig, xmsg)!
dump(verified) // true
assert verified == true
// release the resources
pvkey.free()
pbkey.free()
}