Documentation ¶
Index ¶
- Constants
- func New() hash.Hash
- func NewTruncated() hash.Hash
- func RegisterCodec(cdc *amino.Codec)
- func Sum(bz []byte) []byte
- func SumTruncated(bz []byte) []byte
- type Address
- type HexBytes
- func (bz HexBytes) Bytes() []byte
- func (bz HexBytes) Format(s fmt.State, verb rune)
- func (bz HexBytes) Marshal() ([]byte, error)
- func (bz HexBytes) MarshalJSON() ([]byte, error)
- func (bz HexBytes) String() string
- func (bz *HexBytes) Unmarshal(data []byte) error
- func (bz *HexBytes) UnmarshalJSON(data []byte) error
- type PrivKey
- type PrivKeySecp256k1
- type PubKey
- type PubKeySecp256k1
Constants ¶
const ( Size = sha256.Size BlockSize = sha256.BlockSize )
const ( PrivKeyAminoName = "tendermint/PrivKeySecp256k1" PubKeyAminoName = "tendermint/PubKeySecp256k1" )
-------------------------------------
const PubKeySecp256k1Size = 33
PubKeySecp256k1Size is comprised of 32 bytes for one field element (the x-coordinate), plus one byte for the parity of the y-coordinate.
const (
TruncatedSize = 20
)
Variables ¶
This section is empty.
Functions ¶
func RegisterCodec ¶
RegisterAmino registers all crypto related types in the given (amino) codec.
func SumTruncated ¶
SumTruncated returns the first 20 bytes of SHA256 of the bz.
Types ¶
type Address ¶
type Address = HexBytes
An address is a []byte, but hex-encoded even in JSON. []byte leaves us the option to change the address length. Use an alias so Unmarshal methods (with ptr receivers) are available too.
type HexBytes ¶
type HexBytes []byte
The main purpose of HexBytes is to enable HEX-encoding for json/encoding.
func (HexBytes) MarshalJSON ¶
This is the point of Bytes.
func (*HexBytes) UnmarshalJSON ¶
This is the point of Bytes.
type PrivKeySecp256k1 ¶
type PrivKeySecp256k1 [32]byte
PrivKeySecp256k1 implements PrivKey.
func (PrivKeySecp256k1) Bytes ¶
func (privKey PrivKeySecp256k1) Bytes() []byte
Bytes marshalls the private key using amino encoding.
func (PrivKeySecp256k1) Equals ¶
func (privKey PrivKeySecp256k1) Equals(other PrivKey) bool
Equals - you probably don't need to use this. Runs in constant time based on length of the keys.
func (PrivKeySecp256k1) PubKey ¶
func (privKey PrivKeySecp256k1) PubKey() PubKey
PubKey performs the point-scalar multiplication from the privKey on the generator point to get the pubkey.
type PubKeySecp256k1 ¶
type PubKeySecp256k1 [PubKeySecp256k1Size]byte
PubKeySecp256k1 implements crypto.PubKey. It is the compressed form of the pubkey. The first byte depends is a 0x02 byte if the y-coordinate is the lexicographically largest of the two associated with the x-coordinate. Otherwise the first byte is a 0x03. This prefix is followed with the x-coordinate.
func (PubKeySecp256k1) Address ¶
func (pubKey PubKeySecp256k1) Address() Address
Address returns a Bitcoin style addresses: RIPEMD160(SHA256(pubkey))
func (PubKeySecp256k1) Bytes ¶
func (pubKey PubKeySecp256k1) Bytes() []byte
Bytes returns the pubkey marshalled with amino encoding.
func (PubKeySecp256k1) Equals ¶
func (pubKey PubKeySecp256k1) Equals(other PubKey) bool
func (PubKeySecp256k1) String ¶
func (pubKey PubKeySecp256k1) String() string