Text
Index
Constructors
constructor
Constructs a new
Text
instance by creating a Merkle tree from the given text string. Each character in the text is converted to its ASCII code and stored as a leaf in the tree.Parameters
text: string
The text string to be represented.
height: number = TEXT_TREE_HEIGHT
The height of the Merkle tree. Defaults to
TEXT_TREE_HEIGHT
.
Returns Text
Properties
readonlyheight
The height of the Merkle tree.
readonlyroot
The root of the Merkle tree representing the text data.
readonlysize
The length of the text.
readonlytext
The original text string.
Methods
publictoString
Returns the original text string.
Returns string
The text string.
The
Text
class represents textual data in the form of a Merkle tree. Each character of the text is converted to its ASCII code and stored as a leaf in the Merkle tree. The root of the tree can be used as a compact representation of the text data in cryptographic proofs.