BSV.SPV.MerkleTreeParent (bsv_sdk v1.5.0)

Copy Markdown View Source

Merkle tree parent computation using double-SHA256.

Summary

Functions

Compute the Merkle tree parent of two children (internal byte order).

Compute the Merkle tree parent from display-order (big-endian) hex strings.

Functions

compute(arg1, arg2)

@spec compute(binary(), binary()) :: binary()

Compute the Merkle tree parent of two children (internal byte order).

Hashes are in little-endian (internal) byte order. They are concatenated directly, double-SHA256'd.

compute_hex(left_hex, right_hex)

@spec compute_hex(String.t(), String.t()) :: {:ok, String.t()} | {:error, String.t()}

Compute the Merkle tree parent from display-order (big-endian) hex strings.

Hex strings are byte-reversed, concatenated, double-SHA256'd, then reversed back.