hash

package
v0.0.0-...-caec882 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressLength = 20
)

Lengths of addresses in bytes.

View Source
const (
	HashLength = 32
)

Lengths of hashes in bytes.

Variables

This section is empty.

Functions

func FromHex

func FromHex(data string) []byte

func HashesToBytesS

func HashesToBytesS(hashes []Hash) [][]byte

func IsZeroHash

func IsZeroHash(h Hash) bool

func ToHex

func ToHex(data []byte) string

Types

type Address

type Address [AddressLength]byte

Address represents the 20 byte address of an Ethereum account.

func BytesToAddress

func BytesToAddress(b []byte) Address

func (Address) Bytes

func (a Address) Bytes() []byte

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes Sets the hash to the value of b. If b is larger than len(h), 'b' will be cropped (from the left).

func (Address) String

func (a Address) String() string

type Hash

type Hash [HashLength]byte

Hash represents the 32 byte sha3-256 hash of arbitrary data.

func BytesSToHashes

func BytesSToHashes(bytesS [][]byte) []Hash

func BytesToHash

func BytesToHash(b []byte) Hash

func BytesToSha3

func BytesToSha3(data []byte) Hash

BytesToSha3 creates a new SHA3-256 hash.

func ProtoToSha3

func ProtoToSha3(in proto.Message) (Hash, error)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

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

func (h Hash) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL