Skip to content

Bring the hash function up to the type level

Jean-Paul Calderone requested to merge improved-merkle-representation into main

This is another step towards #19 (closed) Fixes #19 (closed)

The hash function choice is now made in fewer places and carried along to where it is needed by the type system.

A couple hard-coded hash function digest sizes have been removed.

Merkle trees now know their leaf value and hash types for improved comparison safety.

The Share type now includes the hash function (this could be pushed even further up someday if desired).

The encode function now doesn't directly know about a hash function - it uses whatever the rest of the types involved dictate.

Some additional tests using well-known values have been added. Some of the existing tests used sha256 instead of sha256d so these tests have been updated to use sha256d and to compare against a different known-correct digest.

Edited by Jean-Paul Calderone

Merge request reports