1
0
Fork 0
monocypher-ed25519-1M/sodium-ed25519.l
2024-01-29 15:14:14 +02:00

39 lines
860 B
Text

(de L2hex (Lst)
(lowc
(pack
(mapcar '((B) (pad 2 (hex B))) Lst) ) ) )
(de soda_detached (Data Pair)
(let Sign NIL
(native
"libsodium.so"
"crypto_sign_detached"
NIL
'(Sign (64 B . 64))
0
(cons NIL (64) Data)
64
(cons NIL (64) Pair) )
Sign ) )
(de soda_seed_keypair (Seed)
(let (SK NIL PK NIL)
(native
"libsodium.so"
"crypto_sign_seed_keypair"
NIL
'(PK (32 B . 32))
'(SK (64 B . 64))
(cons NIL (32) Seed) )
(list PK SK) ) )
(de soda_start NIL
(native "libsodium.so" "sodium_init") )
(soda_start)
(let (SK (need 64 0) Pair)
(do 1000000
(setq Pair (soda_seed_keypair (head 32 SK)))
(setq SK (soda_detached SK (cadr Pair))) )
(println (L2hex SK)) )
(msg 'ok)
(bye)