Documentation ¶
Index ¶
- func CheckLocalProofs(newHash HashFunc, root hashid.HashId, leaves []hashid.HashId, proofs []Proof) bool
- func CheckProof(newHash HashFunc, root hashid.HashId, leaf hashid.HashId, proof Proof) bool
- func MerkleGet(suite abstract.Suite, root []byte, path MerklePath, ctx hashid.HashGet) ([]byte, error)
- func PrintProofs(proofs []Proof)
- type HashFunc
- type LevelProof
- type MerklePath
- type Proof
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLocalProofs ¶
func CheckProof ¶
func MerkleGet ¶
func MerkleGet(suite abstract.Suite, root []byte, path MerklePath, ctx hashid.HashGet) ([]byte, error)
Retrieve an object in a Merkle tree, validating the entire path in the process. Returns a slice of a buffer obtained from HashGet.Get(), which might be shared and should be considered read-only.
func PrintProofs ¶
func PrintProofs(proofs []Proof)
Types ¶
type LevelProof ¶
LevelProof is used for the Big Merkle Tree (computed from server commits) A []LevelProof from root to server is sufficient proof
type MerklePath ¶
type MerklePath struct { Ptr []int // Offsets of hash-pointers at each intermediate level Ofs int // Offset of relevant object in last-level blob Len int // Length of relevant object in last-level blob }
MerklePath represents a downward path from a (root) node in a Merkle tree to a given (interior or leaf) descendant node, including all the data necessary to validate and extract the descendant. It is assumed the caller has a valid hash-pointer to the root/starting node, and that all nodes in the path can be retrieved via self-certifying hash-ID.
type Proof ¶
Proof is used for Local Merkle Trees (computed based on messages from clients) One Proof sufficient for one leaf in a Local Merkle Tree
func ProofTree ¶
Generate a Merkle proof tree for the given list of leaves, yielding one output proof per leaf.
func (Proof) Calc ¶
Given a Proof and the hash of the leaf, compute the hash of the root. If the Proof is of length 0, simply returns leaf.