From ac32969463280f8fcacbb8f2f9454f299bbcd9a7 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Wed, 30 Sep 2020 10:43:41 -0400 Subject: [PATCH] Minor renames for consistency --- privateKey.go => private_key.go | 0 verify.go | 18 +++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) rename privateKey.go => private_key.go (100%) diff --git a/privateKey.go b/private_key.go similarity index 100% rename from privateKey.go rename to private_key.go diff --git a/verify.go b/verify.go index 1921587..a79101d 100644 --- a/verify.go +++ b/verify.go @@ -72,7 +72,7 @@ func parseSignature(signature string) (sig secp256k1.Signature, recID int, err e } // pubKeyToAddress will convert a pubkey to an address -func pubKeyToAddress(pubkeyXy2 secp256k1.XY, compressed bool, magic []byte) (bcpy []byte) { +func pubKeyToAddress(pubkeyXy2 secp256k1.XY, compressed bool, magic []byte) (byteCopy []byte) { size := 65 if compressed { size = 33 @@ -87,23 +87,23 @@ func pubKeyToAddress(pubkeyXy2 secp256k1.XY, compressed bool, magic []byte) (bcp ripemd160H.Reset() ripemd160H.Write(pubHash1) pubHash2 := ripemd160H.Sum(nil) - bcpy = append(magic, pubHash2...) - hash2 := sha256d(bcpy) - bcpy = append(bcpy, hash2[0:4]...) + byteCopy = append(magic, pubHash2...) + hash2 := sha256d(byteCopy) + byteCopy = append(byteCopy, hash2[0:4]...) return } // addressToString will convert a raw address to a string version -func addressToString(bcpy []byte) (s string, err error) { +func addressToString(byteCopy []byte) (s string, err error) { z := new(big.Int) - z.SetBytes(bcpy) + z.SetBytes(byteCopy) enc := base58.BitcoinEncoding var encodeResults []byte if encodeResults, err = enc.Encode([]byte(z.String())); err != nil { return } s = string(encodeResults) - for _, v := range bcpy { + for _, v := range byteCopy { if v != 0 { break } @@ -208,10 +208,10 @@ func sigMessageToAddress(signature, message string) ([]string, error) { addresses := make([]string, 2) for i, compressed := range []bool{true, false} { - bcpy := pubKeyToAddress(pubkeyXy2, compressed, []byte{byte(0)}) + byteCopy := pubKeyToAddress(pubkeyXy2, compressed, []byte{byte(0)}) var addressString string - addressString, err = addressToString(bcpy) + addressString, err = addressToString(byteCopy) if err != nil { return nil, err }