mirror of https://github.com/waku-org/go-rln.git
fix/pass_memory_correctly (#1)
Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>
This commit is contained in:
parent
7e89c6ca80
commit
970c92157e
11
rln/rln.go
11
rln/rln.go
|
@ -14,11 +14,16 @@ type RLN struct {
|
|||
}
|
||||
|
||||
func (r *RLN) Hash(input []byte) []byte {
|
||||
out := &C.Buffer{}
|
||||
size := int(unsafe.Sizeof(C.Buffer{}))
|
||||
out_ptr := C.malloc(C.size_t(size))
|
||||
|
||||
in := toBuffer(input)
|
||||
size = int(unsafe.Sizeof(C.Buffer{}))
|
||||
in_ptr := C.malloc(C.size_t(size))
|
||||
in := (*C.Buffer)(in_ptr)
|
||||
*in = toBuffer(input)
|
||||
|
||||
C.hash(r.ptr, &in, &in.len, out)
|
||||
out := (*C.Buffer)(out_ptr)
|
||||
C.hash(r.ptr, in, &in.len, out)
|
||||
|
||||
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue