Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -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()
|
||||
}
|
||||
Reference in new issue
Block a user