Description
Implement functions to encode raw bytes to hexadecimal string representation and decode them back.
// {0x48, 0x69} → "4869"
byte_t to_hex(cbytes_t src, unsigned int src_len, bytes_t dst, unsigned long sizeof_dst);
// "4869" → {0x48, 0x69}
byte_t from_hex(cbytes_t hex, bytes_t dst, unsigned long sizeof_dst);
Use cases
- Debug output of binary buffers
- Network protocol inspection
- Cryptographic hash display (MD5, SHA digests)
References
- Encoding: Hexadecimal (Base-16)
- Standard: Each byte is represented as two hex digits (nibbles)
- Wikipedia: Hexadecimal
- Related:
xxd, hexdump Unix tools
Description
Implement functions to encode raw bytes to hexadecimal string representation and decode them back.
Use cases
References
xxd,hexdumpUnix tools