{
  "slug": "hexadecimal",
  "term": "Hexadecimal byte encoding",
  "aliases": [
    "Base16",
    "Base 16",
    "Hex encoding",
    "Hex"
  ],
  "definition": "Hexadecimal byte encoding represents each octet as two hexadecimal characters while preserving the byte sequence.",
  "note": "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. [rfc4648]\n\nValidation: 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. [node-buffer] [hesela-hex]\n\nWhitespace: 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. [python-fromhex]\n\nByte 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. [hesela-hex]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "checksum",
    "byte",
    "byte-order"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-21",
  "citations": [
    {
      "id": "rfc4648",
      "title": "RFC 4648: Base16 encoding, non-alphabet input and test vectors; sections 3.3, 8 and 10",
      "url": "https://www.rfc-editor.org/rfc/rfc4648.html#section-8",
      "accessed": "2026-11-21"
    },
    {
      "id": "node-buffer",
      "title": "Node.js 24 Buffer: hexadecimal encoding and truncated decoding",
      "url": "https://nodejs.org/docs/latest-v24.x/api/buffer.html#buffers-and-character-encodings",
      "accessed": "2026-11-21"
    },
    {
      "id": "python-fromhex",
      "title": "Python 3.12 bytes.fromhex: hexadecimal digits and ASCII whitespace",
      "url": "https://docs.python.org/3.12/library/stdtypes.html#bytes.fromhex",
      "accessed": "2026-11-21"
    },
    {
      "id": "hesela-hex",
      "title": "Hesela: validate the whole hexadecimal checksum",
      "url": "https://hesela.com/analyses/object-etags-checksums-conditional-writes/#hexadecimal-input",
      "accessed": "2026-11-21"
    }
  ],
  "provenance": [
    "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."
  ]
}
