Objects#
-
template<uin32_t N, class Hash, typename Precision>
class tree# A Merkle Tree object. This object is a convenience container for the Merkle Tree Data.
Parameters: -
N: The number of leaves in the base of the tree. -HASH: The hash function used to generate the Merkle Tree. This will be a cuPQC-Hash hash object. -Precision: The data type of the leaves of the Merkle Tree.Members: -
size: The size of the Merkle Tree Data. This is2 * N - 1whereNis the number of leaves in the base of the tree. -digest_size: The digest size of the hash function used to generate the Merkle Tree. This is the length of thePrecisionarray that each node is. -nodes: A pointer to the Merkle Tree Data. This is a global memory array containing2 * N - 1nodes, whereNis the number of leaves in the base of the tree. Each node is of typePrecision, with lengthdigest_sizewheredigest_sizeis the digest size of the hash function used to generate the Merkle Tree. Note that for Hash functions that do not have a digest size, a hash output size is fixed and can be accessed via thedigest_sizemember.Functions: -
allocate_tree: Allocates the Merkle Tree Data to global memory. This is a host function, and is not available on the device. -free_tree: Frees the Merkle Tree Data from global memory. This is a host function, and is not available on the device. -root: Returns a pointer to the root of the Merkle Tree. This is a device function and is not available on the host.
-
template<uin32_t N, class Hash, typename Precision>
class proof# A Proof object generated from a Merkle Tree, used to verify a leaf in the Merkle Tree. This object is a convenience container for the Proof Data.
Parameters: -
N: The number of leaves in the base of the tree. -HASH: The hash function used to generate the Merkle Tree. This is the same as the hash function used to generate the Merkle Tree Data. -Precision: The data type of the leaves of the Merkle Tree. This is the same as the data type of the leaves of the Merkle Tree Data.Members: -
size: The size of the Merkle Tree Data. This islog2(N)whereNis the number of leaves in the base of the tree. -digest_size: The digest size of the hash function used to generate the Merkle Tree. This is the length of thePrecisionarray that each node is. -nodes: A pointer to the Merkle Tree Proof Data. This is a global memory array containinglog2(N)nodes, whereNis the number of leaves in the base of the tree that the proof is generated from. Each node is of typePrecision, with lengthdigest_sizewheredigest_sizeis the digest size of the hash function used to generate the Merkle Tree. Note that for Hash functions that do not have a digest size, a hash output size is fixed and can be accessed via thedigest_sizemember. -indices: A global memory array of 32-bit unsigned integers containinglog2(N)indices, these indices are the locations of the proof nodes in the original tree.Functions: -
allocate_proof: Allocates the Proof Data to global memory. This is a host function, and is not available on the device. -free_proof: Frees the Proof Data from global memory. This is a host function, and is not available on the device.