I looked at the library,
ValidFormat and ValidHash supposed to be working as factory design, you feed them a class type and will get a class, this implementation to remove the need to hardcode a switch between algorithms.
https://en.wikipedia.org/wiki/Factory_method_pattern
but with simple function instead of a class.
I'm not completely sure yet what you want to tell with this.
Is this something which should be changed in
DEC?
Did I mess up something? If so, how should it be changed?
Or was this just some explanation of where the OP's problem comes from?