coniks

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 6 Imported by: 49

Documentation

Overview

Package coniks provides CONIKS hashing for maps.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Default is the standard CONIKS hasher.
	Default = New(crypto.SHA512_256)
)

Domain separation prefixes

Functions

This section is empty.

Types

type Hasher added in v1.3.12

type Hasher struct {
	crypto.Hash
}

Hasher implements the sparse merkle tree hashing algorithm specified in the CONIKS paper.

func New

func New(h crypto.Hash) *Hasher

New creates a new hashers.TreeHasher using the passed in hash function.

func (*Hasher) BitLen added in v1.4.0

func (m *Hasher) BitLen() int

BitLen returns the number of bits in the hash function.

func (*Hasher) EmptyRoot added in v1.4.0

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

EmptyRoot returns the root of an empty tree.

func (*Hasher) HashChildren added in v1.4.0

func (m *Hasher) HashChildren(l, r []byte) []byte

HashChildren returns the internal Merkle tree node hash of the two child nodes l and r. The hashed structure is H(l || r).

func (*Hasher) HashEmpty added in v1.4.0

func (m *Hasher) HashEmpty(treeID int64, root node.ID) []byte

HashEmpty returns the hash of an empty subtree with the given root.

func (*Hasher) HashLeaf added in v1.4.0

func (m *Hasher) HashLeaf(treeID int64, id node.ID, leaf []byte) []byte

HashLeaf calculate the merkle tree leaf value: H(Identifier || treeID || depth || index || dataHash)

Jump to

Keyboard shortcuts

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