From 3bc4752625f60f3126eba8998f80e4789ea5747e Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Tue, 1 Dec 2020 15:36:11 +0800 Subject: [PATCH] chore: remove some print --- keytools/secp256k1.go | 2 +- schnorr/schnorr.go | 6 ++---- schnorr/schnorr_signer_wrapper.go | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/keytools/secp256k1.go b/keytools/secp256k1.go index a379a2d..ccb3510 100644 --- a/keytools/secp256k1.go +++ b/keytools/secp256k1.go @@ -42,7 +42,7 @@ func GeneratePrivateKey() (PrivateKey, error) { } } } - return bytes,nil + return bytes, nil } func GetPublicKeyFromPrivateKey(privateKey []byte, compress bool) []byte { diff --git a/schnorr/schnorr.go b/schnorr/schnorr.go index 4dddd18..2eded2a 100644 --- a/schnorr/schnorr.go +++ b/schnorr/schnorr.go @@ -18,7 +18,6 @@ package go_schnorr import ( "bytes" - "encoding/hex" "errors" "fmt" "github.com/Zilliqa/gozilliqa-sdk/util" @@ -69,7 +68,7 @@ func TrySign(privateKey []byte, publicKey []byte, message []byte, k []byte) ([]b //4. Compute s = k - r * prv // 4a. Compute r * prv _r := *r - s := new(big.Int).Mod(_r.Mul(&_r, priKey),keytools.Secp256k1.N) + s := new(big.Int).Mod(_r.Mul(&_r, priKey), keytools.Secp256k1.N) s = new(big.Int).Mod(new(big.Int).Sub(bintK, s), keytools.Secp256k1.N) if s.Cmp(big.NewInt(0)) == 0 { @@ -117,8 +116,7 @@ func Verify(publicKey []byte, msg []byte, r []byte, s []byte) bool { _r := hash(Q, publicKey, msg) rn := new(big.Int).SetBytes(r) - _rn := new(big.Int).Mod(new(big.Int).SetBytes(_r),keytools.Secp256k1.N) - fmt.Printf("r = %s, _r = %s\n", hex.EncodeToString(r), hex.EncodeToString(_r)) + _rn := new(big.Int).Mod(new(big.Int).SetBytes(_r), keytools.Secp256k1.N) return rn.Cmp(_rn) == 0 } diff --git a/schnorr/schnorr_signer_wrapper.go b/schnorr/schnorr_signer_wrapper.go index b2e7b03..3441094 100644 --- a/schnorr/schnorr_signer_wrapper.go +++ b/schnorr/schnorr_signer_wrapper.go @@ -58,7 +58,6 @@ func VerifySignature(publicKey []byte, message []byte, signature []byte) bool { sig := util.EncodeHex(signature) if len(sig) != 128 { - fmt.Printf("invalid signature length: %v\n", len(sig)) return false }