github.com/turingchain2020/turingchain@v1.1.21/wallet/bipwallet/btcutilecc/keys.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package btcutil
     6  
     7  import (
     8  	"crypto/ecdsa"
     9  	"io"
    10  )
    11  
    12  // GenerateKey generates a public and private key pair
    13  func GenerateKey(rand io.Reader) (*ecdsa.PrivateKey, error) {
    14  	return ecdsa.GenerateKey(Secp256k1(), rand)
    15  }
    16  
    17  // KeysEqual check key equal
    18  func KeysEqual(a, b *ecdsa.PublicKey) bool {
    19  	return a.X.Cmp(b.X) == 0 && a.Y.Cmp(b.Y) == 0
    20  }