Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterSerixRules[V Value](api *serix.API)
- type Hasher
- func (t *Hasher[V]) ComputeProof(values []V, valueToProof V) (*Proof[V], error)
- func (t *Hasher[V]) ComputeProofForIndex(values []V, index int) (*Proof[V], error)
- func (t *Hasher[V]) EmptyRoot() []byte
- func (t *Hasher[V]) Hash(data [][]byte) []byte
- func (t *Hasher[V]) HashValues(values []V) ([]byte, error)
- func (t *Hasher[V]) Size() int
- type LeafHash
- type MerkleHashable
- type MerkleHashableType
- type Node
- type Proof
- type Value
- type ValueHash
Constants ¶
View Source
const ( LeafHashPrefix = 0 NodeHashPrefix = 1 )
Domain separation prefixes.
Variables ¶
View Source
var ( // ErrProofValueNotFound gets returned when the value for which to compute the proof was not found. ErrProofValueNotFound = ierrors.New("the value for which to compute the inclusion proof was not found in the supplied list") )
Functions ¶
func RegisterSerixRules ¶
Types ¶
type Hasher ¶
type Hasher[V Value] struct { // contains filtered or unexported fields }
Hasher implements the hashing algorithm described in the IOTA protocol RFC-12.
func (*Hasher[V]) ComputeProof ¶
ComputeProof computes the audit path given the values and the value we want to create the inclusion proof for.
func (*Hasher[V]) ComputeProofForIndex ¶
ComputeProofForIndex computes the audit path given the values and the index of the value we want to create the inclusion proof for.
func (*Hasher[V]) EmptyRoot ¶
EmptyRoot returns a special case for an empty tree. This is equivalent to Hash(nil).
func (*Hasher[V]) HashValues ¶
HashValues computes the Merkle tree hash of the provided BlockIDs.
type MerkleHashable ¶
type MerkleHashable[V Value] interface { // contains filtered or unexported methods }
type MerkleHashableType ¶
type MerkleHashableType = uint8
const ( MerkleHashableTypeNode MerkleHashableType = iota MerkleHashableTypeLeafHash MerkleHashableType = 1 MerkleHashableTypeValueHash MerkleHashableType = 2 )
type Node ¶
type Node[V Value] struct { Left MerkleHashable[V] `serix:"l"` Right MerkleHashable[V] `serix:"r"` }
Node contains the hashes of the left and right children of a node in the tree.
type Proof ¶
type Proof[V Value] struct { MerkleHashable[V] `serix:",inlined"` }
func (*Proof[V]) ContainsValue ¶
func (*Proof[V]) JSONEncode ¶
Click to show internal directories.
Click to hide internal directories.