Decode a hexadecimal-encoded string into a Uint8Array.
E.g.: hexToBin('2a64ff') → new Uint8Array([42, 100, 255])
Note, this method always completes. If validHex is not divisible by 2,
the final byte will be parsed as if it were prepended with a 0 (e.g. aaa
is interpreted as aa0a). If validHex is potentially malformed, check
it with isHex before calling this method.
Decode a hexadecimal-encoded string into a Uint8Array.
E.g.:
hexToBin('2a64ff')
→new Uint8Array([42, 100, 255])
Note, this method always completes. If
validHex
is not divisible by 2, the final byte will be parsed as if it were prepended with a0
(e.g.aaa
is interpreted asaa0a
). IfvalidHex
is potentially malformed, check it with isHex before calling this method.For the reverse, see binToHex.