Module utils

Source
Expand description

various helper functions.

Functionsยง

frombytecaps
attempt to convert a byte value into a pair of uppercase hexadecimal values.
fromhex
Helper function which takes a mutable slice of expected byte-length and attempts to parse an immutable slice of bytes as hexadecimal characters. Returns an error if src is not exactly twice the size of buf, or if any non-hexadecimal characters are found.
fromval
convert a byte value in range 0x00 to 0x0f to its corresponding lowercase hexadecimal character.
fromvalcaps
convert a byte value in range 0x00 to 0x0f to its corresponding uppercase hexadecimal character.
intobyte
attemt to convert a pair of bytes from a hexadecimal string into their underlying byte representation.
intohex
write hex to buffer.
intohexcaps
write uppercase hex to buffer.
intoval
convert a byte from a hex string to its numeric value. use the tobyte function to convert a pair of hex characters to their actual byte representation.
writehex
Helper function which attempts to convert an immutable set of bytes into hexadecimal characters and write them to some destination.
writehexcaps
Helper function which attempts to convert an immutable set of bytes into capital hexadecimal characters and write them to some destination.