Skip to content

Conversation

@euanh
Copy link
Collaborator

@euanh euanh commented Jul 4, 2025

Motivation

SHA256 is the most common digest algorithm for blobs, but SHA512 can also be used and the image specification provides for other options. This change lays the foundations for generating and validating hashes other than SHA256, and reduces the use of untyped strings to represent digests.

Modifications

  • Parse the digest into separate algorithm and value fields, instead of just validating
  • Add support for parsing and generating SHA512 digests
  • Throw a meaningful error instead of asserting when the registry returns an unexpected digest for an uploaded blob

Result

SHA512 digests can be parsed and verified

Test Plan

Existing tests continue to pass.
New parser tests added for SHA512 digests.

@euanh euanh force-pushed the digest-refactor branch 6 times, most recently from 5e1f7a6 to f37dad9 Compare July 7, 2025 11:51
@euanh euanh force-pushed the digest-refactor branch 2 times, most recently from 124e764 to 8e57769 Compare July 7, 2025 12:03
@euanh euanh force-pushed the digest-refactor branch from 8e57769 to 95fa156 Compare July 7, 2025 12:09
@euanh euanh added kind/enhancement New feature or request semver/patch No public API change. labels Jul 7, 2025
@euanh euanh merged commit 792ca55 into apple:main Jul 7, 2025
23 checks passed
@euanh euanh deleted the digest-refactor branch July 7, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant