From 5d6ecea7ad17251f90fe4fc0a1f1937d0eac47b5 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 6 Sep 2016 14:46:16 +0900 Subject: use byte array --- go/main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'go') diff --git a/go/main.go b/go/main.go index ab902f2..242aa62 100644 --- a/go/main.go +++ b/go/main.go @@ -26,16 +26,13 @@ func main() { sign := C.blsSignCreate() - msg := "Hello bls" - pmsg := C.CString(msg) + msg := []byte("Hello bls") fmt.Println("sign message") - C.blsSecretKeySign(sec, sign, pmsg, C.size_t(len(msg))) + C.blsSecretKeySign(sec, sign, (*C.char)(unsafe.Pointer(&msg[0])), C.size_t(len(msg))) C.blsSignPut(sign) - fmt.Println("verify:", C.blsSignVerify(sign, pub, pmsg, C.size_t(len(msg)))) - - C.free(unsafe.Pointer(pmsg)) + fmt.Println("verify:", C.blsSignVerify(sign, pub, (*C.char)(unsafe.Pointer(&msg[0])), C.size_t(len(msg)))) C.blsPublicKeyDestroy(pub) C.blsSecretKeyDestroy(sec) -- cgit v1.2.3