Table of Contents

MerkleTreeDiagnostics.Node Class

Definition

Namespace
Bodu.Security.Cryptography
Assembly
Bodu.Security.Cryptography.dll
Package
Bodu.Security.Cryptography 1.2.0
Source
MerkleTreeDiagnostics.Node.cs

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

Level int

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.

Index long

The zero-based position of this node within its level.

IsLeaf bool

true if this node is a leaf; false if it is an internal node. Leaf nodes have no child hashes.

Hash byte[]

The hash value computed for this node.

ChildHashes IReadOnlyList<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

IReadOnlyList<byte[]>

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

long

IsLeaf

true if this node is a leaf; false if it is an internal node. Leaf nodes have no child hashes.

public bool IsLeaf { get; init; }

Property Value

bool

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

int

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

Level int
Index long
IsLeaf bool
Hash byte[]
ChildHashes IReadOnlyList<byte[]>

Equals(Node?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(MerkleTreeDiagnostics.Node? other)

Parameters

other MerkleTreeDiagnostics.Node

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

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

left MerkleTreeDiagnostics.Node
right MerkleTreeDiagnostics.Node

Returns

bool

operator !=(Node?, Node?)

public static bool operator !=(MerkleTreeDiagnostics.Node? left, MerkleTreeDiagnostics.Node? right)

Parameters

left MerkleTreeDiagnostics.Node
right MerkleTreeDiagnostics.Node

Returns

bool

Applies to

ProductVersions
.NET8, 10