hexlify#
- hexrec.utils.hexlify(bytestr, sep=None, upper=True)[source]#
Converts raw bytes into a hexadecimal byte string.
- Parameters:
bytestr (bytes) – Source byte string.
sep (bytes) – Optional byte separator.
upper (bool) – Uppercase hexadecimal string.
- Returns:
bytes – Hexadecimal byte string.
Examples
>>> from hexrec.utils import hexlify >>> hexlify(b'\xAA\xBB\xCC') b'AABBCC' >>> hexlify(b'\xAA\xBB\xCC', sep=b' ') b'AA BB CC' >>> hexlify(b'\xAA\xBB\xCC', sep=b'-') b'AA-BB-CC' >>> hexlify(b'\xAA\xBB\xCC', upper=False) b'aabbcc'