Documentation ¶
Index ¶
- Constants
- func CheckErr(e error)
- func EncodeECDSAKeys(privateKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) ([]byte, []byte)
- func FetchPrivateKey(kpath string) *ecdsa.PrivateKey
- func FetchPublicKey(kpath string) *ecdsa.PublicKey
- func FetchPublicKeyBytes(kpath string) ([]byte, error)
- func HashBlockHeader(header *pb.PbftBlockHeader) []byte
- func HashTxns(txns []*pb.Transaction) []byte
- func MakeDirIfNot(dir string)
- func MyPrint(t int, format string, args ...interface{})
- type Hash
- func (h Hash) Big() *big.Int
- func (h Hash) Bytes() []byte
- func (h Hash) Format(s fmt.State, c rune)
- func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value
- func (h Hash) Hex() string
- func (h Hash) MarshalText() ([]byte, error)
- func (h *Hash) SetBytes(b []byte)
- func (h Hash) String() string
- func (h Hash) TerminalString() string
- func (h *Hash) UnmarshalJSON(input []byte) error
- func (h *Hash) UnmarshalText(input []byte) error
Constants ¶
const HashLength = 32
HashLength defines length of hashes (32 bytes)
Variables ¶
This section is empty.
Functions ¶
func CheckErr ¶
func CheckErr(e error)
CheckErr simply checks errors and panics, as a guilty pleasure.
func EncodeECDSAKeys ¶
EncodeECDSAKeys takes in ECDSA objects for key pairs and returns encoded []byte formats
func FetchPrivateKey ¶
func FetchPrivateKey(kpath string) *ecdsa.PrivateKey
FetchPrivateKey reads and decodes a private key from file stored on disk
func FetchPublicKey ¶
FetchPublicKey reads and decodes a public key from file stored on disk
func FetchPublicKeyBytes ¶
FetchPublicKeyBytes fetches ECDSA public key in []byte form
func HashBlockHeader ¶
func HashBlockHeader(header *pb.PbftBlockHeader) []byte
HashBlockHeader returns a hash for a block header
func HashTxns ¶
func HashTxns(txns []*pb.Transaction) []byte
HashTxns returns a hash of all the transactions using Merkle Patricia tries
Types ¶
type Hash ¶
type Hash [32]byte
Hash defines a hash of 32 bytes
func BigToHash ¶
BigToHash sets byte representation of b to hash. If b is larger than len(h), b will be cropped from the left.
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
func HexToHash ¶
HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func (Hash) Format ¶
Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.
func (Hash) MarshalText ¶
MarshalText returns the hex representation of h.
func (*Hash) SetBytes ¶
SetBytes sets the hash to the value of b. If b is larger than len(h), b will be cropped from the left.
func (Hash) String ¶
String implements the stringer interface and is used also by the logger when doing full logging into a file.
func (Hash) TerminalString ¶
TerminalString implements log.TerminalStringer, formatting a string for console output during logging.
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON parses a hash in hex syntax.
func (*Hash) UnmarshalText ¶
UnmarshalText parses a hash in hex syntax.