hash

package
v0.0.0-...-a8cc34e Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: LGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const Hash256Size = 32

Hash256Size is 32 bytes

Variables

View Source
var (
	ErrInvalidHashSize   = errors.New("invalid hash size")
	ErrInvalidHashFormat = errors.New("invalid hash format")
)

hash256 errors

Functions

This section is empty.

Types

type Hash256

type Hash256 [Hash256Size]byte

Hash256 is the [Hash256Size]byte with methods

func DoubleHash

func DoubleHash(data []byte) Hash256

DoubleHash returns the result of Hash(Hash(data))

func Hash

func Hash(data []byte) Hash256

Hash returns the Hash256 value of the data

func Hashes

func Hashes(hs ...Hash256) Hash256

Hashes returns the result of Hash(h1+'h'+...)

func MustParseHash

func MustParseHash(str string) Hash256

MustParseHash panic when error occurred

func ParseHash

func ParseHash(str string) (Hash256, error)

ParseHash parse the hash from the string

func (Hash256) MarshalJSON

func (hash Hash256) MarshalJSON() ([]byte, error)

MarshalJSON is a marshaler function

func (Hash256) String

func (hash Hash256) String() string

String returns the hex string of the hash

func (*Hash256) UnmarshalJSON

func (hash *Hash256) UnmarshalJSON(bs []byte) error

UnmarshalJSON is a unmarshaler function

Jump to

Keyboard shortcuts

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