hexadecimal · shipping · also Base16, Base 16, Hex encoding, Hex

Hexadecimal byte encoding

Hexadecimal byte encoding represents each octet as two hexadecimal characters while preserving the byte sequence.

Representation: Each character represents four bits, so an octet requires two characters and no padding. Base16 is case-insensitive; a protocol requiring one canonical text spelling must specify its letter case. Encoding bytes is not checksum computation, encryption or compression. [1]

Validation: Node Buffer.from(text, 'hex') can truncate at a non-hex character or an unmatched final digit. Both 1a7 and 1ag123 decode to the single byte 1a. Even a full-length digest followed by invalid text can produce the expected digest bytes. Decoded length and equality alone do not validate the complete input. [2] [4]

Whitespace: Python bytes.fromhex accepts ASCII whitespace between complete byte pairs: aa bb decodes to aabb, while a b is rejected. An unseparated checksum profile must reject that whitespace before decoding. The accepted alphabet, length, separators and case policy belong to the representation contract. [3]

Byte identity: Preserve leading zero bytes: 0001 and 01 encode different byte sequences. Hex display does not assign integer byte order; the bytes 01 00 represent 256 as a big-endian unsigned integer and 1 as little-endian. [4]

Relations

related
Checksum, Byte, Byte order

Citations

  1. RFC 4648: Base16 encoding, non-alphabet input and test vectors; sections 3.3, 8 and 10 (accessed 2026-11-21)
  2. Node.js 24 Buffer: hexadecimal encoding and truncated decoding (accessed 2026-11-21)
  3. Python 3.12 bytes.fromhex: hexadecimal digits and ASCII whitespace (accessed 2026-11-21)
  4. Hesela: validate the whole hexadecimal checksum (accessed 2026-11-21)
Sources & caveats
  • Primary-source synthesis and synthetic native decoder checks; no storage-service experiment or vulnerability claim.
  • Reproducible observations, runtime versions and controls: https://hesela.dev/research/hexadecimal/observations.json and https://hesela.dev/research/hexadecimal/probe.test.mjs.

JSON: /data/terms/hexadecimal.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Hexadecimal byte encoding. Hesela. 2026-11-21. https://hesela.dev/terms/hexadecimal/