Make merkle-tree-stream generic over hash types
yoshuawuyts opened this issue · comments
Right now a hash is always a buffer. This is not ideal because before comparing we need to cast it back to the original Hash
type to ensure that we have constant-time comparisons (which is an essential security feature).
Therefore I propose we make this module a generic over a Hash type so we can get away with fewer conversions. Thanks!
Maybe we should even make the Node types generic. We can provide a default implementation, but it's super useful to be able to extend them with custom traits.
This has been done!