forked from mirror/go-ethereum
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.
19 lines
387 B
19 lines
387 B
package ethutil
|
|
|
|
type Key struct {
|
|
PrivateKey []byte
|
|
PublicKey []byte
|
|
}
|
|
|
|
func NewKeyFromBytes(data []byte) *Key {
|
|
val := NewValueFromBytes(data)
|
|
return &Key{val.Get(0).Bytes(), val.Get(1).Bytes()}
|
|
}
|
|
|
|
func (k *Key) Address() []byte {
|
|
return Sha3Bin(k.PublicKey[1:])[12:]
|
|
}
|
|
|
|
func (k *Key) RlpEncode() []byte {
|
|
return EmptyValue().Append(k.PrivateKey).Append(k.PublicKey).Encode()
|
|
}
|
|
|