MerkleTreeDiagnostics.Node Class
Definition
- Namespace
- Bodu.Security.Cryptography
- Assembly
- Bodu.Security.Cryptography.dll
- Package
- Bodu.Security.Cryptography 1.2.0
Represents a single node captured during a Merkle tree computation, recording the child hashes used as input and the hash value produced as output.
public sealed record MerkleTreeDiagnostics.Node : IEquatable<MerkleTreeDiagnostics.Node>
- Inheritance
-
MerkleTreeDiagnostics.Node
- Implements
- Inherited Members
- Extension Methods
Constructors
Node(int, long, bool, byte[], IReadOnlyList<byte[]>)
Represents a single node captured during a Merkle tree computation, recording the child hashes used as input and the hash value produced as output.
public Node(int Level, long Index, bool IsLeaf, byte[] Hash, IReadOnlyList<byte[]> ChildHashes)
Parameters
LevelintThe zero-based level of this node within the tree. Level 0 contains leaf nodes derived directly from input entries or blocks; higher levels contain internal nodes derived by combining groups of child hashes.
IndexlongThe zero-based position of this node within its level.
IsLeafbooltrue if this node is a leaf; false if it is an internal node. Leaf nodes have no child hashes.
Hashbyte[]The hash value computed for this node.
ChildHashesIReadOnlyList<byte[]>The child hash values whose concatenation was hashed to produce
Hash. Empty for leaf nodes.
Properties
ChildHashes
The child hash values whose concatenation was hashed to produce Hash. Empty for leaf nodes.
public IReadOnlyList<byte[]> ChildHashes { get; init; }
Property Value
Hash
The hash value computed for this node.
public byte[] Hash { get; init; }
Property Value
- byte[]
Index
The zero-based position of this node within its level.
public long Index { get; init; }
Property Value
IsLeaf
public bool IsLeaf { get; init; }
Property Value
Level
The zero-based level of this node within the tree. Level 0 contains leaf nodes derived directly from input entries or blocks; higher levels contain internal nodes derived by combining groups of child hashes.
public int Level { get; init; }
Property Value
Methods
Deconstruct(out int, out long, out bool, out byte[], out IReadOnlyList<byte[]>)
public void Deconstruct(out int Level, out long Index, out bool IsLeaf, out byte[] Hash, out IReadOnlyList<byte[]> ChildHashes)
Parameters
Equals(Node?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(MerkleTreeDiagnostics.Node? other)
Parameters
otherMerkleTreeDiagnostics.NodeAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(Node?, Node?)
public static bool operator ==(MerkleTreeDiagnostics.Node? left, MerkleTreeDiagnostics.Node? right)
Parameters
leftMerkleTreeDiagnostics.NoderightMerkleTreeDiagnostics.Node
Returns
operator !=(Node?, Node?)
public static bool operator !=(MerkleTreeDiagnostics.Node? left, MerkleTreeDiagnostics.Node? right)
Parameters
leftMerkleTreeDiagnostics.NoderightMerkleTreeDiagnostics.Node
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |