Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func IsValidPrivateKey(key *ecdsa.PrivateKey) bool
- func P2PPubKeyBytesToPubKey(theBytes []byte) (*ecdsa.PublicKey, error)
- func P2PPubKeyBytesToPubKeyBytes(theBytes []byte) ([]byte, error)
- func P2PPubkeyToPubkey(theKey p2pcrypto.PubKey) (*ecdsa.PublicKey, error)
- func PrivateKeyToP2PKey(key *ecdsa.PrivateKey) (p2pcrypto.PrivKey, p2pcrypto.PubKey, error)
- func PrivateKeyToP2PPrivKey(key *ecdsa.PrivateKey) (p2pcrypto.PrivKey, error)
- func PubKeyToP2PPubkey(key *ecdsa.PublicKey) (p2pcrypto.PubKey, error)
- func PubkeyBytesToAddress(pubBytes []byte) common.Address
- func PubkeyToHash(p ecdsa.PublicKey) common.Hash
Constants ¶
View Source
const (
NGenerateKey = 10
)
Variables ¶
View Source
var (
BitSize = 256
)
View Source
var (
ErrInvalidKey = errors.New("invalid key")
)
Functions ¶
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
func IsValidPrivateKey ¶
func IsValidPrivateKey(key *ecdsa.PrivateKey) bool
IsValidPrivateKey is to ensure that crypto.S256() is the same as btcec.S256() (p2pcrypto is using btcec.S256, while ecsda is using crypto.S256)
func P2PPubKeyBytesToPubKey ¶
func PrivateKeyToP2PKey ¶
func PrivateKeyToP2PPrivKey ¶
func PrivateKeyToP2PPrivKey(key *ecdsa.PrivateKey) (p2pcrypto.PrivKey, error)
func PubkeyBytesToAddress ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.