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!

descriptor.md Outdated
[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. Implementations MAY implement BLAKE3 digest verification for use in descriptors.

When the _algorithm identifier_ is `blake3`, the _encoded_ portion MUST match `/[a-f0-9]{128}/`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
When the _algorithm identifier_ is `blake3`, the _encoded_ portion MUST match `/[a-f0-9]{128}/`.
When the _algorithm identifier_ is `blake3`, the _encoded_ portion MUST match `/[a-f0-9]{64}/`.

👀

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

descriptor.md Outdated
Comment on lines 167 to 168
[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. Implementations MAY implement BLAKE3 digest verification for use in descriptors.
Copy link
Member

Choose a reason for hiding this comment

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

I think we normally split-on-sentence here (maybe @sudo-bmitch can confirm; he's been more pedantic/on top of that than I am):

Suggested change
[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. Implementations MAY implement BLAKE3 digest verification for use in descriptors.
[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.
Implementations MAY implement BLAKE3 digest verification for use in descriptors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with the split-on-sentence. It makes future PRs a lot easier to review (a one world change doesn't rewrap a paragraph).

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@@ -220,3 +229,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://www.ietf.org/archive/id/draft-aumasson-blake3-00.html
Copy link
Member

Choose a reason for hiding this comment

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

"Expires: 21 January 2025"

That's a little bit worrying 😅 any idea where discussion of these things usually happens? Would it make sense to link to something like https://blake3.io/ instead, or is this the best reference since https://blake3.io/ just redirects to the GitHub repo in the very next URL?

Copy link
Contributor

Choose a reason for hiding this comment

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

blake3.io redirects to the blake3 implementation repo. 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. Not sure if either is more canonical than the other.

Copy link
Author

@rchincha rchincha Feb 9, 2025

Choose a reason for hiding this comment

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

https://github.com/BLAKE3-team/BLAKE3-specs

^ probably initial work, far more dated.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

C2SP has a tagged pointer to their copy of the spec, which has me leaning that direction: https://c2sp.org/[email protected]

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 <[email protected]>
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.

3 participants