Convert between Bytes and hexadecimal strings.
fromBytes encodes Bytes into a lowercase hex String.fromWord32 encodes a 32-bit Int into a lowercase 2-char hex String.toBytes decodes a hex String (mixed-case) into Bytes, with validation.toBytesUnchecked decodes a lowercase hex String into Bytes, without validation.Join 4 byte lookups into one 8-char string inline. This keeps the accumulator list 4x shorter than pushing individual 2-char strings, which matters because List.reverse + String.concat scale with list length.
Parse a hex string into Bytes. Returns Nothing if the string has
odd length or contains non-hex characters. Accepts both uppercase and
lowercase hex digits.
toBytes "ff"
--> Just <1 byte>
toBytes "zz"
--> NothingParse a lowercase hex string into Bytes. Does not validate the input:
assumes even length and only lowercase hex characters (0-9, a-f).
About 20% faster than toBytes.
toBytesUnchecked "ff"
--> <1 byte>
Convert
Bytesto a lowercase hex string.