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{}
|
r := &RLN{}
|
||||||
|
|
||||||
buf := toBuffer(parameters)
|
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
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
package rln
|
package rln
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHash(t *testing.T) {
|
func TestNew(t *testing.T) {
|
||||||
rln := New(0, []byte{})
|
params, err := ioutil.ReadFile("./testdata/parameters.key")
|
||||||
rln.Hash([]byte{1, 2, 3})
|
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