Skip to content

feat(services/s3): support sha256 checksum algorithm#7829

Open
wolfv wants to merge 1 commit into
apache:mainfrom
wolfv:feat/s3-sha256-checksum
Open

feat(services/s3): support sha256 checksum algorithm#7829
wolfv wants to merge 1 commit into
apache:mainfrom
wolfv:feat/s3-sha256-checksum

Conversation

@wolfv

@wolfv wolfv commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

S3 supports several checksum algorithms for verifying upload integrity (e.g. for buckets with Object Lock). OpenDAL's S3 service already supports crc32c and md5, but not sha256, which is one of the most commonly used and is accepted by S3 for both single and multipart uploads.

What changes are included in this PR?

  • Add a Sha256 variant to the internal ChecksumAlgorithm enum, mapping to the x-amz-checksum-sha256 header.
  • Compute the base64-encoded SHA256 digest of the body via a new format_sha256_iter helper (using the sha2 crate) in calculate_checksum.
  • Accept "sha256" for the checksum_algorithm config / builder option.
  • Send the per-part ChecksumSHA256 element when completing multipart uploads.
  • Add a unit test guarding the SHA256 digest output and update docs.

Are there any user-facing changes?

Yes. "sha256" is now a valid value for the S3 checksum_algorithm option. Builder and config docs are updated. No breaking changes.

AI Usage Statement

This PR was prepared with the assistance of Claude Code (Claude Opus 4.8). All changes were reviewed by the author.

Add SHA256 as a selectable checksum algorithm for S3 uploads,
alongside the existing CRC32C and MD5 options. When configured,
the SHA256 digest of the body is computed and sent via the
x-amz-checksum-sha256 header for single uploads, and as the
per-part ChecksumSHA256 element when completing multipart uploads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wolfv wolfv requested a review from Xuanwo as a code owner June 29, 2026 13:45
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 29, 2026
@wolfv wolfv force-pushed the feat/s3-sha256-checksum branch from a50f725 to a105eaf Compare June 29, 2026 16:46
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 29, 2026
@Xuanwo

Xuanwo commented Jun 30, 2026

Copy link
Copy Markdown
Member

Thank you for working on this! My hope is that once we have #6817, we don't need to implement this for every service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants