Documentation ¶
Overview ¶
Package merkle provides functions for creating and validating MAM compatible Merkle trees.
Index ¶
- func MerkleBranch(tree Trits, siblings Trits, treeLength, treeDepth, leafIndex, leafCount uint64) (Trits, error)
- func MerkleCreate(baseSize uint64, seed Trytes, offset uint64, security SecurityLevel, ...) (Trits, error)
- func MerkleDepth(nodeCount uint64) (depth uint64)
- func MerkleLeafIndex(leafIndex, leafCount uint64) uint64
- func MerkleNodeIndex(depth, width, treeDepth uint64) uint64
- func MerkleRoot(hash Trits, siblings Trits, siblingsNumber uint64, leafIndex uint64, ...) (Trits, error)
- func MerkleSize(leafCount uint64) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MerkleBranch ¶
func MerkleBranch(tree Trits, siblings Trits, treeLength, treeDepth, leafIndex, leafCount uint64) (Trits, error)
MerkleBranch creates the Merkle branch to generate back root from index.
tree is the Merkle tree - Must be allocated siblings is the siblings of the indexed node - Must be allocated treeLength is the length of the tree treeDepth is the depth of the tree leafIndex is the index of the leaf to start the branch from leafCount is the number of leaves of the tree
func MerkleCreate ¶
func MerkleCreate(baseSize uint64, seed Trytes, offset uint64, security SecurityLevel, spongeFunc ...sponge.SpongeFunction) (Trits, error)
MerkleCreate creates a Merkle tree.
baseSize is the base size of the tree, e.g. the number of leaves seed is the seed used to generate addresses - Not sent over the network offset is the offset used to generate addresses security is the security used to generate addresses spongeFunc is the optional sponge function to use
func MerkleDepth ¶
MerkleDepth computes the depth of a Merkle tree.
nodeCount is the number of nodes of the tree
func MerkleLeafIndex ¶
MerkleLeafIndex computes the actual site index of a leaf.
leafIndex is the leaf index leafCount is the number of leaves
func MerkleNodeIndex ¶
MerkleNodeIndex indexes a given node in the tree.
depth is the depth of the node, counting from root width is the width of the node, counting from left treeDepth is the depth of whole tree
func MerkleRoot ¶
func MerkleRoot(hash Trits, siblings Trits, siblingsNumber uint64, leafIndex uint64, spongeFunc ...sponge.SpongeFunction) (Trits, error)
MerkleRoot generates a Merkle root from a hash and his siblings,
hash is the hash siblings is the hash siblings siblingsNumber is the number of siblings leafIndex is the node index of the hash spongeFunc is the optional sponge function to use
func MerkleSize ¶
MerkleSize computes the size of a Merkle tree, e.g. its node number.
leafCount is the number of leaves of the tree
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.