hash

package
v0.37.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: AGPL-3.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

View Source
const HashLen = 32

HashLen is the ledger default output hash length in bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash [HashLen]byte

Hash is the hash type used in all ledger

var DummyHash Hash

DummyHash is an arbitrary hash value, used in function errors. DummyHash represents a valid hash value.

func HashInterNode

func HashInterNode(hash1 Hash, hash2 Hash) Hash

HashInterNode returns the hash value for intermediate nodes. hash1 and hash2 are fixed-length byte arrays which should be holding exactly 32 bytes each.

func HashLeaf

func HashLeaf(path Hash, value []byte) Hash

HashLeaf returns the hash value for leaf nodes. Path is a fixed-length byte array which should be holding exactly 32 bytes. Note that we don't include the keys here as they are already included in the path.

func ToHash

func ToHash(bytes []byte) (Hash, error)

ToHash converts a byte slice to Hash (fixed-length byte array). It returns an error if the slice has an invalid length.

func (Hash) MarshalJSON added in v0.25.0

func (h Hash) MarshalJSON() ([]byte, error)

func (Hash) String added in v0.23.2

func (h Hash) String() string

func (*Hash) UnmarshalJSON added in v0.25.0

func (h *Hash) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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