3 ms·
This seems to be a conceptual mistake that often happens when coming from high level languages, I have seen similar confusion on stack overflow relating to pack
by the8472 7y ago
This seems to be a conceptual mistake that often happens when coming from high level languages, I have seen similar confusion on stack overflow relating to packet based network protocols.
What many low-level data formats deal with are raw bytes ("byte strings" in some contexts). The output of a hasher is random binary data.
What most humans are accustomed to are some form of encoding that makes it easier to spell out the octets. Hex and base64 are common. But they are not the native representation that the machine deals with.
With almost everything being explicit in rust you need an explicit conversion from bytes to hex, base64, urlencode or some other format.
Those conversion methods (with their contract often expressed as a separate trait) may be provided by the same crate or you may have to pull them in from a different crate.
A hasher does not need to provide this itself because its output types can be enhanced by foreign traits.