Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blake3 as a registered/supported hash algorithm. #1240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rchincha
Copy link

@rchincha rchincha commented Feb 6, 2025

Motivations for this PR:

  1. Blake3 is a high performance hash and there is growing community interest
  2. Blake3 is variable output, but mandate 256-bit output

Copy link
Contributor

@sudo-bmitch sudo-bmitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should specify that implementations "MAY" support the algorithm, and specify the encoded value regexp, similar to the sha512 definition.

@rchincha rchincha force-pushed the blake3 branch 2 times, most recently from 2733aae to a2ce39a Compare February 7, 2025 05:51
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor typo fix (wrong number of bits in the regex 🙈), a little whitespace pedanticism (that I'm hoping @sudo-bmitch will confirm or reject/deny), and what can probably/hopefully just be a discussion of the URL to link to (not necessarily requesting any change there).

Overall the change looks good and I'm +1; thanks for taking a stab!

@rchincha rchincha force-pushed the blake3 branch 2 times, most recently from b20ba52 to 139e306 Compare February 13, 2025 03:41
Copy link
Contributor

@sudo-bmitch sudo-bmitch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor white-space nit to align paragraphs with other registered algorithms. Otherwise LGTM.

sudo-bmitch
sudo-bmitch previously approved these changes Feb 14, 2025
@@ -161,6 +162,16 @@ Implementations MAY implement SHA-512 digest verification for use in descriptors
When the _algorithm identifier_ is `sha512`, the _encoded_ portion MUST match `/[a-f0-9]{128}/`.
Note that `[A-F]` MUST NOT be used here.

#### BLAKE3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the new section, you'll want a new entry in the registered-algorithms table up around line 140, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

descriptor.md Outdated
@@ -220,3 +231,5 @@ In the following example, the descriptor indicates the type of artifact it is re
[rfc7230-s2.7]: https://tools.ietf.org/html/rfc7230#section-2.7
[sha256-vs-sha512]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/hsMw7cAwrZE
[iana]: https://www.iana.org/assignments/media-types/media-types.xhtml
[blake3]: https://github.com/C2SP/C2SP/blob/main/BLAKE3.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spinning out of this earlier thread:

Linking to the https://github.com/BLAKE3-team/BLAKE3-specs or https://github.com/C2SP/C2SP/blob/main/BLAKE3.md would each make sense to me.

I'm not an approver, so feel free to ignore me, but personally, having a versioned spec that links to a floating document makes me a bit concerned about image-spec v1.2.0 (or whatever image-spec release eventually ships this registration) being a moving target. Can we pin a specific version of the BLAKE3 spec, e.g. via their BLAKE3/v1.0.0 tag with https://github.com/C2SP/C2SP/blob/BLAKE3/v1.0.0/BLAKE3.md ? It currently matches their main content for that file, and if they tweak the file in the future, e.g. with a BLAKE3/v1.1.0, or dev work in preparation for such a release, it wouldn't get retroactively sucked into image-spec v1.2.0, and would take explicit decisions by image-spec maintainers and implementors to pull in whatever the new BLAKE3 changes were.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Motivations for this PR:
1. Blake3 is a high performance hash and there is growing community
   interest
2. Blake3 is variable output but mandate 256-bit output

Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>

[BLAKE3][blake3] is a high performance, highly parallelizable, collision-resistant hash function which [is more performant][blake3-vs-sha2] than
[SHA-256][rfc4634-s4.1].
The hash output length MUST be 256 bits.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with BLAKE3, but going through the spec, it seems like we might also need to specify the hash hashing mode? Or is it sufficiently obvious from the context that there's no provision for supplying a key or other input, making the keyed_hash and derive_key modes unfeasible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants