hash

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HashSize = 32

Variables

View Source
var ErrInvalidSQLType = errors.New("invalid SQL type")

ErrInvalidSQLType is returned when the type of the data is not supported for SQL database operations.

View Source
var UndefHash = Hash{0}

Functions

func Hash160

func Hash160(data []byte) []byte

func Hash256

func Hash256(data []byte) []byte

Types

type Hash

type Hash [HashSize]byte

func CalcHash

func CalcHash(data []byte) Hash

func FromBytes

func FromBytes(data []byte) (Hash, error)

FromBytes constructs a new hash from raw byte data.

func FromString

func FromString(str string) (Hash, error)

FromString constructs a new hash from a hex-encoded string.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes returns the raw byte representation of the hash.

func (Hash) IsUndef

func (h Hash) IsUndef() bool

func (Hash) LogString added in v1.11.0

func (h Hash) LogString() string

LogString returns a concise string representation intended for use in logs.

func (Hash) ShortString added in v0.15.0

func (h Hash) ShortString() string

ShortString returns a shortened string representation of the hash.

func (Hash) String

func (h Hash) String() string

String returns the hex-encoded string representation of the hash.

Jump to

Keyboard shortcuts

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