-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwots.go
43 lines (39 loc) · 1.05 KB
/
wots.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package wots
/*
#cgo CFLAGS: -I${SRCDIR}
#include "wots.h"
*/
import "C"
import "unsafe"
func wotsPkgen(seed [32]byte, pubSeed [32]byte, addr [32]byte) [2144]byte {
var pk [2144]byte
C.wots_pkgen(
(*C.word8)(unsafe.Pointer(&pk[0])),
(*C.word8)(unsafe.Pointer(&seed[0])),
(*C.word8)(unsafe.Pointer(&pubSeed[0])),
(*C.word32)(unsafe.Pointer(&addr[0])),
)
return pk
}
func wotsSign(msg [32]byte, seed [32]byte, pubSeed [32]byte, addr [32]byte) [2144]byte {
var sig [2144]byte
C.wots_sign(
(*C.word8)(unsafe.Pointer(&sig[0])),
(*C.word8)(unsafe.Pointer(&msg[0])),
(*C.word8)(unsafe.Pointer(&seed[0])),
(*C.word8)(unsafe.Pointer(&pubSeed[0])),
(*C.word32)(unsafe.Pointer(&addr[0])),
)
return sig
}
func wotsPkFromSig(sig [2144]byte, msg [32]byte, pubSeed [32]byte, addr [32]byte) [2144]byte {
var pk [2144]byte
C.wots_pk_from_sig(
(*C.word8)(unsafe.Pointer(&pk[0])),
(*C.word8)(unsafe.Pointer(&sig[0])),
(*C.word8)(unsafe.Pointer(&msg[0])),
(*C.word8)(unsafe.Pointer(&pubSeed[0])),
(*C.word32)(unsafe.Pointer(&addr[0])),
)
return pk
}