# Hexadecimal decoding contracts

This is a synthetic native API illustration, not a storage-service test, a
security finding or a benchmark. Node and Python decode the same deliberately
chosen strings. The 19 inputs cover both cases, leading zeros, odd lengths,
non-alphabet suffixes, all six ASCII whitespace characters, split byte pairs,
non-ASCII whitespace and lookalikes. Hex outputs are lowercase display strings.

Run with Node and Python 3 available:
```sh
node probe.mjs --check
node --test probe.test.mjs
```

The replay compares values and reports both recorded and current runtime
versions. It does not rewrite the frozen observation file. An intentional
new recording uses `node probe.mjs --write`. The tests independently check
RFC vectors and all 65,536 two-byte sequences in upper/lower spellings.

The SHA-256 example hashes the literal ASCII bytes abc using Node's standard
crypto implementation. It appends malformed text to the digest representation.
Node still returns 32 equal bytes; this is documented truncation, not a hash
collision. The illustrative predicate accepts exactly 64 ASCII hex characters
of either case and nothing else. It is not an authentication or object-integrity
verifier. A case-sensitive canonical-text profile needs a separate case rule.

Sources reviewed 2026-11-21:
- RFC 4648 sections 3.3, 8 and 10:
  https://www.rfc-editor.org/rfc/rfc4648.html
- Node 24 Buffer encoding/truncation contract:
  https://nodejs.org/docs/latest-v24.x/api/buffer.html#buffers-and-character-encodings
- Python 3.12 bytes.fromhex contract:
  https://docs.python.org/3.12/library/stdtypes.html#bytes.fromhex

Preserve the actual runtime versions in observations.json. This experiment
does not establish the policies of S3, other services or unrelated decoders.
