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.