Merge the top two hashes into one.
Start creating the authpath for the node on the top.
Sanity test for hash_stack.
t { import dcrypt.pqc.sphincs.sphincs256: hash_2n_n; enum hash_bytes = 32; alias ubyte[hash_bytes] hash_t; alias TreeUtil!(hash_2n_n, ubyte[hash_bytes], ubyte[2*hash_bytes]) Tree; Tree.hash_stack!4 stack; hash_t mask1 = 111; hash_t mask2 = 222; ubyte[2*hash_bytes] mask = mask1~mask2; hash_t[4] l; for(uint i = 0; i < l.length; ++i) l[i] = cast(ubyte) (i+1); assert(stack.empty); stack.push(l[0]); stack.push(l[1]); assert(l[1] == stack.pop()); assert(l[0] == stack.pop()); stack.push(l[0]); stack.push(l[1]); stack.reduce(mask); hash_t hash1 = stack.pop(); assert(stack.empty); hash_t hash2 = hash_nodes(l[0], l[1], mask); assert(hash1 == hash2)
Helper struct for treehash algorithm.