Repository navigation
Add BLAKE3 hash function - #61
Conversation
|
to what extent is |
|
@vbatts that's blake2b which is != blake3. I can also add blake2b, but it's a fundamentally different hash. |
|
We use zeebo/blake3 in prod. Blake2 doesn't have formal specifications for XOF, or a a tree hash, whereas blake3 does. IIRC, there are variants of blake2b that support XOF and tree hash, but AFAIK, they're not formalized. |
|
ah, i wasn't saying that "2b" and "3" were the same or equivalent. |
| import ( | ||
| "hash" | ||
|
|
||
| "github.com/zeebo/blake3" |
There was a problem hiding this comment.
I'm not sure we want blake3 dependency in this repo (until blake3 becomes popular in the OCI ecosystem).
Instead, can we add functions for dynamically adding algorithms?
e.g.,
package digest
func Register(algorithm string, siz int, newHash func ()hash.Hash)There was a problem hiding this comment.
I can do that refactor.
|
Please see: This PR can move forward if we add a "sub-module" that has the blake3 bits, and people can import that in order to get that function to register. |
|
Can we have |
|
That's my plan. |
fc04afd to
eec210a
Compare
| "hash" | ||
|
|
||
| "github.com/opencontainers/go-digest" | ||
| "github.com/zeebo/blake3" |
There was a problem hiding this comment.
Is there any chance that this implementation will substantively change if there is a canonical (e.g. golang.org/x/crypto/...) package for blake3?
There was a problem hiding this comment.
No. The cryptoHash interface is a subset of the hash interface in standard Go.
There was a problem hiding this comment.
Oh, I meant the hash algorithm itself, not the interface itself.:-)
There was a problem hiding this comment.
The algorithm itself has been released and specified. It's in production use in a bunch of places. I'm pretty sure it's considered stable at this point.
|
Is this still a draft? |
|
@vbatts it's good to go. I have one small additional change of moving around the definition of the digest (name), but that can be next. |
This adds support for the BLAKE3 hash family with a default output size of 256-bit. Signed-off-by: Sargun Dhillon <[email protected]>
Because blake3 is a different go module, go test ./... doesn't traverse into it, so it needs a separate stanza in the github actions to test it. Signed-off-by: Sargun Dhillon <[email protected]>
|
@vbatts This should be ready for review.
|
vbatts
left a comment
There was a problem hiding this comment.
Thanks for the iterations on this.
LGTM
|
@AkihiroSuda Do you have any outstanding concerns? |
|
@dmcgowan PTAL |
This adds the default BLAKE3 hash function with a default output size of 256-bit. If we want to add support for other sizes in the future, I suggest that we do something like
blake3-512orblake3_512. Given that BLAKE3 can have an arbitrary output size, I'm unsure which "variants" we should add.