Skip to content

Commit

Permalink
fixed private key log output in case of error
Browse files Browse the repository at this point in the history
  • Loading branch information
torao committed Jan 6, 2020
1 parent 0295e0f commit 1fecb81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions crypto/vrf/internal/vrf/vrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package vrf
/*
#cgo CFLAGS: -I./libsodium/src/libsodium/include
#cgo LDFLAGS: -lsodium
#include "./libsodium/src/libsodium/include/sodium.h"
#include "./crypto/vrf/internal/vrf/libsodium/src/libsodium/include/sodium.h"
*/
import "C"
import (
Expand Down Expand Up @@ -61,8 +61,7 @@ func Prove(privateKey *[SECRETKEYBYTES]byte, message []byte) (*[PROOFBYTES]byte,
messagePtr := (*C.uchar)(unsafe.Pointer(&message))
messageLen := (C.ulonglong)(len(message))
if C.crypto_vrf_prove(proofPtr, privateKeyPtr, messagePtr, messageLen) != 0 {
return nil, errors.New(fmt.Sprintf("unable to decode the given privateKey: %s",
hex.EncodeToString(privateKey[:])))
return nil, errors.New(fmt.Sprintf("unable to decode the given privateKey"))
}
return &proof, nil
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/vrf/vrf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,6 @@ func TestProve(t *testing.T) {
if err3 != nil {
t.Errorf("failed to verify: %s", err3)
} else if ! bytes.Equal(hash1[:], hash2[:]) {
t.Errorf("output incompativle: %s != %s", enc(hash1[:]), enc(hash2[:]))
t.Errorf("incompatible output: %s != %s", enc(hash1[:]), enc(hash2[:]))
}
}

0 comments on commit 1fecb81

Please sign in to comment.