package hashers
import "github.com/google/trillian/merkle/hashers"
Index ¶
- func RegisterLogHasher(h trillian.HashStrategy, f LogHasher)
- func RegisterMapHasher(h trillian.HashStrategy, f MapHasher)
- type LogHasher
- type MapHasher
Functions ¶
func RegisterLogHasher ¶
func RegisterLogHasher(h trillian.HashStrategy, f LogHasher)
RegisterLogHasher registers a hasher for use.
func RegisterMapHasher ¶
func RegisterMapHasher(h trillian.HashStrategy, f MapHasher)
RegisterMapHasher registers a hasher for use.
Types ¶
type LogHasher ¶
type LogHasher interface { // EmptyRoot supports returning a special case for the root of an empty tree. EmptyRoot() []byte // HashLeaf computes the hash of a leaf that exists. HashLeaf(leaf []byte) []byte // HashChildren computes interior nodes. HashChildren(l, r []byte) []byte // Size is the number of bits in the underlying hash function. // TODO(gbelvin): Replace Size() with BitLength(). Size() int }
LogHasher provides the hash functions needed to compute dense merkle trees.
func NewLogHasher ¶
func NewLogHasher(h trillian.HashStrategy) (LogHasher, error)
NewLogHasher returns a LogHasher.
type MapHasher ¶
type MapHasher interface { // HashEmpty returns the hash of an empty branch at a given depth. // A height of 0 indicates an empty leaf. The maximum height is Size*8. // TODO(gbelvin) fully define index. HashEmpty(treeID int64, index []byte, height int) []byte // HashLeaf computes the hash of a leaf that exists. HashLeaf(treeID int64, index []byte, leaf []byte) []byte // HashChildren computes interior nodes. HashChildren(l, r []byte) []byte // Size is the number of bytes in the underlying hash function. // TODO(gbelvin): Replace Size() with BitLength(). Size() int // BitLen returns the number of bits in the underlying hash function. // It is also the height of the merkle tree. BitLen() int }
MapHasher provides the hash functions needed to compute sparse merkle trees.
func NewMapHasher ¶
func NewMapHasher(h trillian.HashStrategy) (MapHasher, error)
NewMapHasher returns a MapHasher.
Source Files ¶
- Version
- v1.0.2
- Published
- Oct 10, 2017
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 2 hours ago –
Tools for package owners.