INFINITE UPSIDE

Technology and operations

Is an S3 ETag a Checksum of Your File?

Two files can have different ETags without proving their contents are different. The upload path matters.

A team uploads a video to Amazon S3 and writes down its ETag. Later, a second copy of the same video produces a different ETag. The natural reaction is that one copy must be corrupt. That conclusion may be right, but the ETag alone has not earned it. The two uploads may have used different methods, encryption settings or part boundaries.

An S3 ETag is an entity tag associated with an object; it is not a universal whole-file checksum. In certain single-part cases it is the MD5 digest of the object data, but AWS documents important exceptions, including multipart uploads and some encryption choices. For integrity verification, compare the right checksum for the same bytes and algorithm, and check whether it represents the full object or a composite of parts. The S3 integrity documentation describes these distinctions.

Start with the question you need answered

“Did this file arrive intact?” is different from “Did the object change since I last saw it?” It is different again from “Is this the file our team approved?” Those questions can overlap, but a single label in a storage console should not be expected to answer all three.

For transfer integrity, the useful comparison is between a known value derived from the intended source bytes and an independently calculated or service-validated value for the stored object, using a compatible method. For an identity or approval question, the team also needs trustworthy records linking the value to the correct file and version. If the original reference was created from the wrong file, a perfect match can confirm that the wrong file was copied perfectly.

Imagine a production team with a master file, a compressed review copy and a caption file. All three can have legitimate checksums. A record that says only “hash verified” leaves a future teammate guessing which file, which version and which algorithm the record refers to. A small manifest with names, sizes, algorithm and expected values makes the verification useful again next week.

Why the ETag sometimes looks like MD5

A digest function calculates a fixed-length value from input data. If the bytes change accidentally, a well-chosen checksum will usually change too. MD5 is one such digest, often shown as 32 hexadecimal characters. A hexadecimal-looking ETag, however, is not a promise that a whole-file MD5 was used.

AWS says that certain objects created through single-part PUT, POST or copy operations, and stored unencrypted or with S3-managed server-side encryption, have ETags corresponding to MD5 digests of object data. It also lists cases where they do not. In particular, its documentation says ETags for objects encrypted using customer-provided keys or AWS KMS keys are not MD5 digests of the object data. Confirm the actual object and upload path instead of assuming that every single-part object follows the first case.

The distinction has practical consequences. If a local file’s MD5 and an ETag match under a documented compatible case, that can be useful evidence about the bytes. If they do not match, first ask whether they are comparable at all. A mismatch against an ETag from an incompatible upload method is a signal to investigate, not proof by itself that the transfer damaged the file.

Multipart changes the calculation

Multipart upload divides an object into parts for upload and later assembles them. It can make large transfers easier to resume or parallelize, but the final ETag for an object created this way is not the MD5 digest of the complete object. AWS describes the multipart ETag calculation using the part digests and a suffix indicating the part count. The service’s multipart overview also cautions that the final ETag is not necessarily an MD5 of the object data.

Suppose one operator uploads an archive in one request and another uploads the same source bytes in several parts. Their final ETags can differ because the upload methods differ. Likewise, changing part boundaries can change a multipart-derived value. Neither observation proves that either stored archive is good. It tells the team that comparing those ETags as if they were identical full-file hashes is the wrong test.

Do not try to reverse-engineer an unknown upload merely from a suffix and then declare a match. The record needs the service, operation and actual checksum semantics. Client tools can make choices on the user’s behalf, including selecting multipart upload for larger files, so a person who clicked “upload” may not know the details without checking the tool’s behavior and logs.

Use a checksum that answers the intended question

S3 supports several checksum algorithms and checksum types, with different availability depending on the operation and upload method. AWS distinguishes a full-object checksum from a composite checksum calculated from part-level values. The names matter: a composite SHA-256 value should not automatically be compared with the SHA-256 digest calculated over the entire local file as one byte stream. Consult the service’s current algorithm and type tables for the exact operation.

A basic workflow can be as simple as this: identify the exact source file, calculate an appropriate full-file checksum using a trusted tool, record the algorithm and value, upload using a method that supports the intended validation, and retain the service’s returned checksum and object version or other identifying details. If the upload request includes a supported precomputed checksum, S3 can validate it against the data received under the documented operation. A failed validation needs investigation; do not merely record that an upload was attempted.

When the service’s recorded checksum is composite, either compare it with the corresponding composite calculation using the correct part information or use another documented full-object verification method. A complete download and local calculation can independently check the retrieved object bytes, but it costs time, bandwidth and potentially service charges. Select a verification method proportionate to the value and risk of the file, and check applicable allowances before choosing a large repeated transfer.

Metadata is not the same as a verified object

Many systems let a user attach custom metadata such as a field named “sha256.” That can be a useful place to store a reference value, but the field itself does not prove the service calculated or checked it. If the uploader put the wrong value in metadata, copying the metadata later only preserves the wrong assertion. Distinguish a user-supplied label from a checksum the service actually validated or computed.

Likewise, a matching file name and byte count are helpful checks but weak substitutes for an integrity comparison. Two different files can have the same name and length. A successful API response shows that the service accepted an operation; it does not by itself tell a reviewer which local file the team intended to upload or whether a later download was readable.

Keep versioning in view. If a key has been overwritten, a checksum for yesterday’s version may be accurate and still not describe what a viewer retrieves today. Our guide to S3 versioning and delete markers explains why a key name, a version and the current visible object are separate facts. An integrity record should identify the exact version when versioning and the operation expose one.

Integrity is not authenticity or a backup strategy

Checksums are useful for detecting corruption, but they are not automatically signatures. If an attacker can replace both the file and the stored checksum in the same place, the two can match while the approved original has been replaced. For authenticity, protect the reference through an appropriate trusted channel or use a suitable digital-signature scheme; the security design depends on who can change the object and the record.

Algorithm choice matters too. MD5 remains relevant because some systems expose it, but published collision attacks make it unsuitable where collision resistance is required and it should not be treated as a strong defense against a deliberate substitution. For security-sensitive decisions, select an appropriate modern cryptographic method and a trusted reference, not whichever field happens to be displayed most prominently in the console.

A verified upload also does not establish that a restore process works. Access permissions, encryption keys, version selection and dependencies can all matter when someone needs the data back. The backup-restore guide covers that separate operational test. An object can be intact and inaccessible, or accessible while missing the files needed to use it.

What to keep in the handoff

For a file worth preserving, record the source identifier and size, the algorithm and exact expected value, the destination bucket and key, the object version where applicable, the upload and verification method, and the date and result. Keep the manifest somewhere that will survive the same failure you are trying to recover from, with access limited to people who need it. Avoid putting confidential names or credentials into a broadly shared report.

If the values do not agree, pause before replacing or deleting either copy. Confirm that the same bytes, encoding and algorithm were compared; check whether a tool modified the file, whether a multipart composite was mistaken for a full-object digest, and whether the correct object version was retrieved. Only then investigate a genuine transfer or storage problem. The point is not to worship a long string of characters. It is to know exactly what that string proves.

Explore Infinite Upside

For Vijay Sheth’s personal accounts, read Infinite Upside: Building Wealth With Room to Live, published by Sheth Capital, Inc.

Find your edition · Chapter companion

ABOUT THE CONTRIBUTOR

Luna Lim

DIRECTOR OF FINANCIAL RESEARCH & EDITORIAL STRATEGY

SHETH CAPITAL, INC.

Luna Lim writes about business, investing, and the judgment behind financial decisions. She joined PCH Exotics Inc. as Director of Operations in 2022, working across La Jolla and Miami. Today, she reports directly to Vijay Sheth at Sheth Capital, Inc., bringing an operator’s perspective to the ideas she covers.

Based in Pacific Beach, California, Luna is curious about the people behind the numbers: what they’re building, how they weigh uncertainty, and what makes a risk worth taking. Her articles for Infinite Upside follow those questions through the details, with clear explanations and a feel for how decisions play out in everyday business.

More from Luna Lim

The Infinite Upside store