Verify Object Integrity Using Checksums in Stook
Learn how to validate object integrity in Stook using checksums exposed through ETag.
Checksum validation helps you ensure that data is stored and transferred without corruption. When you upload an object, Stook calculates a checksum and stores it as the object’s ETag. You can:
Retrieve the ETag from Stook, and
Optionally compute your own checksum locally (for example, using Python) and compare the values for single-part uploads.
Requirements
Make sure you have:
A Stook bucket containing the object you want to verify
Access Key and Secret Key
One or more of the following tools installed:
AWS CLI
MinIO Client (
mc)Python with
boto3(optional, for local checksum calculation)
Retrieve the checksum (ETag) from Stook
You can retrieve the ETag value using AWS CLI, MinIO Client, or curl.
Use AWS CLI
aws s3api --endpoint-url https://<ENDPOINT_URL> \
head-object \
--bucket <BUCKET_NAME> \
--key <OBJECT_KEY> \
--profile <AWS_PROFILE>The output includes the ETag:
Use MinIO Client (mc)
Example output:
Use curl over the Stook endpoint
If you access the object directly via the Stook endpoint, you can inspect the ETag header:
If the Stook bucket is connected to a CDN Resource, you can also send the request through the CDN URL. However, note that the ETag header may change when served via CDN, depending on caching and response headers.
Understand ETag and multipart behavior
ETag behaves differently for single-part and multipart uploads:
Single-part uploads
ETag typically represents the MD5 checksum of the entire object.
In this case, a locally computed MD5 of the file can match the ETag.
Multipart uploads
ETag has the format:
This value does not match the MD5 checksum of the entire file.
If you see a mismatch between local MD5 and ETag, the object may have been uploaded as multipart.
Compute a local checksum in Python (Optionally)
Python examples are provided only to calculate local checksums on the client side. They do not calculate or change the checksum stored by Stook; they simply:
Download the object from Stook, and
Compute MD5 or SHA-256 locally so you can compare it with the ETag (for single-part uploads) or use it in your own integrity checks.
Example — Compute an MD5 checksum in Python
Example — Compute a SHA-256 checksum in Python
Troubleshoot checksum mismatches
If you notice a mismatch between a local checksum and the ETag from Stook:
The object may have been uploaded as multipart, so the ETag will not match the MD5 of the full file.
You may be using a different algorithm (for example, SHA-256 locally vs MD5-based ETag).
You may be comparing against an outdated or changed local file.
Always verify:
Upload method (single-part vs multipart)
The algorithm used
That you are comparing the correct object version
Summary
Stook calculates a checksum when an object is uploaded and exposes it via the ETag header.
You can read ETag using AWS CLI, MinIO Client, or curl.
ETag corresponds to an MD5-like checksum only for single-part uploads.
For multipart uploads, ETag follows a special format and does not match the MD5 of the full file.
Python examples compute local MD5 or SHA-256 and are used only for client-side integrity validation, not for calculating Stook’s internal checksum.
Last updated
Was this helpful?