Closed helinwang closed 6 years ago
Thanks for the great library!
Maybe https://github.com/herumi/mcl/blob/d798881e3bcc634afd718b8a7fc62e3060dda6f5/ffi/go/mcl/mcl.go#L148-L151
Should compare with 0, not 1? E.g.,
func (x *Fr) SetHashOf(buf []byte) bool { // #nosec return C.mclBnFr_setHashOf(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) == 0 }
Since the success value seems to be 0, and the failure value seems to be -1: https://github.com/herumi/mcl/blob/e6c316cbbd2e75a158578aed0f592141e85bf754/src/bn_c_impl.hpp#L193
Thank you for your verification. I fixed it.
Thank you! Btw, same issue with "github.com/dfinity/go-dfinity-crypto/bls" if you also maintains it: https://github.com/dfinity/go-dfinity-crypto/blob/master/bls/mcl.go#L136
@herumi if you don't mind, maybe rename err to success for clarity:
err
success := x.SetHashOf([]byte("abc")) if !success { t.Error(err) }
Thanks for the great library!
Maybe https://github.com/herumi/mcl/blob/d798881e3bcc634afd718b8a7fc62e3060dda6f5/ffi/go/mcl/mcl.go#L148-L151
Should compare with 0, not 1? E.g.,
Since the success value seems to be 0, and the failure value seems to be -1: https://github.com/herumi/mcl/blob/e6c316cbbd2e75a158578aed0f592141e85bf754/src/bn_c_impl.hpp#L193