You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
431 B
17 lines
431 B
package keys
|
|
|
|
import (
|
|
secp256k1 "github.com/btcsuite/btcd/btcec"
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
)
|
|
|
|
type Dump struct {
|
|
PrivateKey, PublicKeyCompressed, PublicKey string
|
|
}
|
|
|
|
func EncodeHex(sk *secp256k1.PrivateKey, pk *secp256k1.PublicKey) *Dump {
|
|
p0 := sk.Serialize()
|
|
p1 := pk.SerializeCompressed()
|
|
p2 := pk.SerializeUncompressed()
|
|
return &Dump{hexutil.Encode(p0), hexutil.Encode(p1), hexutil.Encode(p2)}
|
|
}
|
|
|