mirror of https://github.com/waku-org/go-rln.git
made new work
This commit is contained in:
parent
2e02e6d97b
commit
b6e723c29b
|
@ -17,7 +17,12 @@ func New(depth int, parameters []byte) *RLN {
|
|||
r := &RLN{}
|
||||
|
||||
buf := toBuffer(parameters)
|
||||
C.new_circuit_from_params(C.ulong(depth), &buf, &r.ptr)
|
||||
|
||||
size := int(unsafe.Sizeof(buf))
|
||||
in := (*C.Buffer)(C.malloc(C.size_t(size)))
|
||||
*in = buf
|
||||
|
||||
C.new_circuit_from_params(C.ulong(depth), in, &r.ptr)
|
||||
|
||||
return r
|
||||
}
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
package rln
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHash(t *testing.T) {
|
||||
rln := New(0, []byte{})
|
||||
rln.Hash([]byte{1, 2, 3})
|
||||
func TestNew(t *testing.T) {
|
||||
params, err := ioutil.ReadFile("./testdata/parameters.key")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rln := New(32, params)
|
||||
|
||||
if rln.ptr == nil {
|
||||
t.Fatal("pointer not initialized.")
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue