TECHNOLOGY

Exact dataset hashes: define the bytes before comparing documents

In this article
THE QUICK TAKE

A digest identifies the representation that was hashed; normalization decisions remain part of the comparison contract.

A checksum starts with a byte sequence

Python hashlib consumes bytes. A digest of a downloaded archive therefore answers a different question from a digest of an extracted text field. Compression metadata, line endings and text encoding can change the first representation while a reader sees equivalent content in the second.

Name the hashed object explicitly. Keep a raw payload digest for retrieval integrity and a separate text digest if the pipeline compares extracted documents. Replacing the raw digest with the text digest removes evidence needed to investigate extraction changes.

Text normalization defines a new identity

Unicode normalization can give canonically equivalent character sequences a common representation. Compatibility normalization makes additional distinctions disappear. This choice is consequential for identifiers, mathematical notation and technical examples; visual similarity alone is not a sufficiently precise rule.

Treat normalization as a versioned transformation before hashing. Store the selected form, encoding and treatment of whitespace with its output. A lowercasing or whitespace-collapse step is an additional policy decision, not an inherent property of a cryptographic digest.

Canonical JSON has a specific contract

RFC 8785 defines JSON Canonicalization Scheme rules, including serialization and property ordering. It preserves Unicode string data rather than silently normalizing it. A serializer with sorted keys is not automatically a complete implementation of that specification.

Decide which metadata belongs inside the canonical object. Adding a retrieval timestamp changes a record digest even when document text stays identical. Conversely, omitting source identity deliberately allows distinct provenance records to share a content digest. Neither result should be mistaken for an unexplained collision.

Digest matches need a retention rule

An equality group still requires a decision about which record to retain. The oldest source, the fullest document and the best provenance may be different records. Preserve their association even when the training payload is stored only once.

Use a modern digest appropriate to the integrity requirement and consider byte comparison when the consequence warrants it. A hash alone does not authenticate the publisher, establish usage permission or show that nearby paragraphs are unique. Those questions need separate evidence.

Audit representation changes with examples

A proposed review set can include alternate line endings, composed characters, reordered JSON properties and changed source metadata. Inspect which pairs should share raw, normalized and record-level identifiers before processing a large corpus. These are suggested checks, not reported experimental results.

When an extraction or normalization policy changes, regenerate affected identifiers and keep the mapping between revisions. This makes a changed duplicate count explainable: the corpus may have changed, the comparison representation may have changed, or both.

Primary references

Python hashlib.

Unicode normalization forms.

JSON Canonicalization Scheme.

Related explanations: Deduplication and memorization; Document provenance.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles