Skip to main content

Module solution

Module solution 

Source
Expand description

Representation and validation of Equi-X puzzle solutions

Equi-X uses its own tweaked version of the Equihash algorithm. Solutions are arrays of SolutionItems, each representing one item in a space of hash outputs. The SolutionItems form a binary tree with constraints on the sorting order of the items and on the sums of their corresponding hashes.

Structsยง

Solution
Potential solution to an EquiX puzzle

Constantsยง

EQUIHASH_K ๐Ÿ”’
Equihash K parameter for Equi-X, the number of tree layers
EQUIHASH_N ๐Ÿ”’
Equihash N parameter for Equi-X, number of bits used from the hash output

Functionsยง

branches_are_sorted ๐Ÿ”’
Ordering predicate for each node of the SolutionItem tree
check_all_tree_sums ๐Ÿ”’
Check all tree sums, using the full size defined by EQUIHASH_N.
check_tree_order ๐Ÿ”’
Check tree ordering recursively.
check_tree_sums ๐Ÿ”’
Check hash sums recursively.
item_hash ๐Ÿ”’
Compute a HashValue from a SolutionItem
sort_into_tree_order ๐Ÿ”’
Sort a solution in-place into tree order.

Type Aliasesยง

HashValue ๐Ÿ”’
One hash value, computed from a SolutionItem
SolutionArray
A bundle of solutions as returned by one invocation of the solver
SolutionByteArray
A byte array of the right length to convert to/from a Solution
SolutionItem
One item in the solution
SolutionItemArray
A raw Item array which may or may not be a well-formed Solution