Checksums and integrity
We detect changed bytes and distinguish integrity from ownership and content safety. A matching client claim is useful only when the expected value belongs to the intended object. We will compare concrete digests, define checksum scope, verify downloads, and inspect multipart identity.
#Section 17A checksum detects a changed byte sequence
Heron stores a score-export payload Heron:7:120. Its ASCII encoding has 11 bytes. Changing the final score character produces Heron:7:121, also 11 bytes, so length alone cannot detect the difference. A checksum is a compact value computed from bytes to help detect changes under a chosen error or adversary model.
The numeric script computes SHA-256 for both payloads. Their digests begin 5eae8f64 and 09a87f96, respectively. It also computes CRC32 values 4,221,786,988 and 2,359,585,786. These are computed examples; neither equal length nor a filename can substitute for checking the intended byte content.
A cryptographic hash addresses stronger collision and adversarial requirements than a simple error-detection checksum, but a hash supplied by the same untrusted uploader does not prove the content is authorized or safe. Integrity asks whether bytes match the intended bytes; permission and inspection ask different questions.
#Section 18Bind the expected value to the upload
The client reports checksum X during initiation, then uploads different bytes and reports checksum Y on completion. If Heron accepts the changed claim without comparison, it has not checked the reserved upload. Retain the expected algorithm, checksum value, and length with the upload identity.
Constrain the delegated operation when supported so storage validates the claimed checksum. On completion, compare observed verified attributes with the reservation. If the chosen multipart checksum is composite, its meaning and part layout need to match the expected representation. Do not compare checksums with different scopes just because both look like hex strings.
The expected value may still originate from the client for transfer integrity. That is acceptable when the goal is detecting corruption between the client’s chosen bytes and storage. For a trusted signed source or fixed server artifact, expected evidence should come from that trusted publisher instead. State which integrity problem you are solving.
#Section 19ETag is not a universal content digest
A service returns an ETag, an entity validator associated with a representation. Do not assume its format always equals a whole-object MD5 digest. Multipart construction, encryption, and product rules can change that relationship.
S3’s checksum documentation distinguishes full-object and composite checksums and documents multipart ETag limitations. Use the explicit supported checksum fields with a known algorithm and scope. An ETag can still be useful for conditional retrieval without being the integrity value your application expected.
When copying or reassembling objects, checksum representation can change while bytes remain equal. Keep the checksum’s type and scope beside its value in metadata. A migration that compares only raw strings can falsely reject equal content or falsely accept incompatible evidence.
#Section 20Verify reads and bound verification work
The upload passed checks, but a later worker reads media for conversion. Verify the retrieved content according to its trusted metadata when the workflow requires end-to-end integrity. Stream the checksum calculation as bytes arrive rather than making a second full in-memory copy.
A range read can retrieve an illustrative 1,000,000-byte sample from a 5,000,000,000-byte object. That is 0.0002 of the object, or 0.02%. At the assumed 10,000,000 bytes per second it transfers in 0.1 seconds before overhead. A whole-object checksum cannot be recomputed from that tiny range alone.
Chunk-level trusted hashes can validate independently retrieved pieces, but that adds a manifest and its own authenticity requirement. The manifest becomes authoritative metadata. A complete design accounts for its storage, transfer, versioning, and association with the exact immutable object.