This commit is contained in:
decanus 2021-09-13 22:06:26 +02:00
parent 970c92157e
commit e928e8a25a
No known key found for this signature in database
GPG Key ID: 3730AAF5D6589867
1 changed files with 3 additions and 6 deletions

View File

@ -15,15 +15,12 @@ type RLN struct {
func (r *RLN) Hash(input []byte) []byte { func (r *RLN) Hash(input []byte) []byte {
size := int(unsafe.Sizeof(C.Buffer{})) size := int(unsafe.Sizeof(C.Buffer{}))
out_ptr := C.malloc(C.size_t(size))
size = int(unsafe.Sizeof(C.Buffer{})) size = int(unsafe.Sizeof(C.Buffer{}))
in_ptr := C.malloc(C.size_t(size)) in := (*C.Buffer)(C.malloc(C.size_t(size)))
in := (*C.Buffer)(in_ptr)
*in = toBuffer(input)
out := (*C.Buffer)(out_ptr) out := (*C.Buffer)(C.malloc(C.size_t(size)))
C.hash(r.ptr, in, &in.len, out) C.hash(r.ptr, in, size, out)
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)) return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len))
} }