Expand description
Lowercase hex for digest bytes.
Exists because sha2 0.11 (via digest 0.11 and hybrid-array) returns
a plain Array from finalize/digest, and that type no longer
implements LowerHex the way GenericArray did in 0.10. Every
format!("{:x}", ...) on a hash therefore stopped compiling.
One helper rather than an inline fold at each of the four call sites:
these strings are content-addressing keys and graph fingerprints that get
compared against values already written to disk, so all four must agree
on the encoding exactly. A single function makes that agreement
structural instead of a thing four separate lines have to keep getting
right.
Deliberately not a new dependency. The whole job is two lines, and a digest is the only thing this codebase ever hex-encodes.
Functionsยง
- encode
- Encode
bytesas lowercase hex, two characters per byte.