merkle

package
v0.0.0-...-d02f37a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package merkle implements the Merkle tree hash computation.

Index

Constants

View Source
const (
	LeafHashPrefix = 0
	NodeHashPrefix = 1
)

Domain separation prefixes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher struct {
	// contains filtered or unexported fields
}

Hasher implements the hashing algorithm described in the IOTA protocol RFC-12.

func NewHasher

func NewHasher(h crypto.Hash) *Hasher

NewHasher creates a new Hasher using the provided hash function.

func (*Hasher) EmptyRoot

func (t *Hasher) EmptyRoot() []byte

EmptyRoot returns a special case for an empty tree. This is equivalent to Hash(nil).

func (*Hasher) Hash

func (t *Hasher) Hash(data []encoding.BinaryMarshaler) ([]byte, error)

Hash computes the Merkle tree hash of the provided data encodings.

func (*Hasher) Size

func (t *Hasher) Size() int

Size returns the length, in bytes, of a digest resulting from the given hash function.

Jump to

Keyboard shortcuts

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