package coniks

import "github.com/google/trillian/merkle/coniks"

Package coniks provides CONIKS hashing for maps.

Index

Variables

var (

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

Domain separation prefixes

Types

type Hasher

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

func (m *Hasher) BitLen() int

BitLen returns the number of bits in the hash function.

func (*Hasher) EmptyRoot

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

EmptyRoot returns the root of an empty tree.

func (*Hasher) HashChildren

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

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

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)

Source Files

coniks.go

Version
v1.7.1 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
5 days ago

Tools for package owners.