You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can add support for it (though b3 has many configurable hash lengths -- how do we pick the best one?), but I do think we also need to work on making sure that tooling which generates images supports mixed-digest images (and maybe that should be done first). It's not just a matter of being able to handle different hashing algorithms, it's that you need to have a way of either regenerating all hashes in an image tree with different digest algorithms or otherwise determining what is the best hash algorithm to use given an existing image that you're creating a modified version of.
For instance, given a descriptor tree full of SHA-256 digests you probably want to use SHA-256, but if there's a SHA-512 in there which should you use for new digests when creating a new image? Maybe you want to opt for the newest algorithm in use by an image digest tree? Either way I think most tools already don't handle SHA-512 in the most ideal way, so we need to work on that.
And finally it would be nice if we had a way of not having to duplicate the same underlying data if the hashing algorithm referring to it is different (layers being the most important example of this). But then again, tools can also be sufficiently clever about this (store an out-of-spec lookup table which knows the hash of each object under multiple hashing algorithms).
There seemed to be a circular nature between go-digest and image-spec. Mostly I'm starting the issue so I can get blake3 added to go-digest, but the process by which you get new hashes added to go-digest is to first add get them registered here.
I also wanted to start the conversation of what the prefix should be. I suggested b3-256 in my initial issue description, because b3 = blake3, 256-bit, where 256 bits is the default b3sum output.
Previously, the motivation to add blake3 was not clear.
blake3 is very fast even on generic h/w and that should definitely help with large artifact production and verification.
Switching to blake3 is indeed faster. I built a PoC of the oras tool, which uses blake3 by default (the PoC release v1.2.0-blake3 can be downloaded at here).
Here's a test run for oras pushing an 10G file to a local folder in OCI image layout.
Although blake3 is faster, the blake3 is not a NIST approved algorithm. Therefore, I have concerns to use blake3 in FIPS scenarios as well as signing scenarios.
I think using the blake3 bare name for the digest algorithm that uses the default 256 bits as established by opencontainers/go-digest#61 seems fine and I don't have major objections to adding something about this in the spec to codify it. I think we do have interesting problems here with interpretability, backwards compatibility, cross-digest, etc, but nothing that isn't already an established issue with the ostensibly supported/codified SHA-512. Should we fix those issues, or offer guidance of some kind? Sure. However, I think that's mostly orthogonal here, especially as Blake3 has more interesting reasons for users to choose it than SHA-512 does, so it's really possible this helps exacerbate those issues to the point where they have to be hammered out (or get hammered out with the benefit/pain of production usage).
In short, +1 to optional support for blake3: referring to the 256-bit implementation in the spec itself.
Activity
cyphar commentedon Jan 25, 2021
We can add support for it (though b3 has many configurable hash lengths -- how do we pick the best one?), but I do think we also need to work on making sure that tooling which generates images supports mixed-digest images (and maybe that should be done first). It's not just a matter of being able to handle different hashing algorithms, it's that you need to have a way of either regenerating all hashes in an image tree with different digest algorithms or otherwise determining what is the best hash algorithm to use given an existing image that you're creating a modified version of.
For instance, given a descriptor tree full of SHA-256 digests you probably want to use SHA-256, but if there's a SHA-512 in there which should you use for new digests when creating a new image? Maybe you want to opt for the newest algorithm in use by an image digest tree? Either way I think most tools already don't handle SHA-512 in the most ideal way, so we need to work on that.
And finally it would be nice if we had a way of not having to duplicate the same underlying data if the hashing algorithm referring to it is different (layers being the most important example of this). But then again, tools can also be sufficiently clever about this (store an out-of-spec lookup table which knows the hash of each object under multiple hashing algorithms).
cyphar commentedon Jan 25, 2021
Also this will need probably need a https://github.com/opencontainers/go-digest PR first?
sargun commentedon Jan 25, 2021
There seemed to be a circular nature between
go-digestandimage-spec. Mostly I'm starting the issue so I can get blake3 added to go-digest, but the process by which you get new hashes added to go-digest is to first add get them registered here.I also wanted to start the conversation of what the prefix should be. I suggested
b3-256in my initial issue description, because b3 = blake3, 256-bit, where 256 bits is the default b3sum output.sargun commentedon Feb 15, 2021
I added a proposal to add
blake3, where the default hash length is 256-bit as suggested in the spec.rchincha commentedon Jun 29, 2024
Previously, the motivation to add blake3 was not clear.
blake3 is very fast even on generic h/w and that should definitely help with large artifact production and verification.
rchincha commentedon Jul 8, 2024
quick test
20 vCPU (Intel Xeon Gold 5218)
blake3 (parallel, so uses all available cores)
$ time b3sum test.img (100GiB)
253da5f3c5802f7a2c30b16a29ae4aa3830be8d5be57e31778087ea060f7def9 test.img
real 0m48.493s
sha256sum (can only use single core)
$ time sha256sum test.img
f0b14a8da7f1c48a0846647a078b97956edd8df451a62fc4b466879aa24d4fd7 test.img
real 10m49.152s
rchincha commentedon Jul 29, 2024
opencontainers/go-digest#104
shizhMSFT commentedon Aug 6, 2024
Switching to
blake3is indeed faster. I built a PoC of theorastool, which usesblake3by default (the PoC releasev1.2.0-blake3can be downloaded at here).Here's a test run for
oraspushing an 10G file to a local folder in OCI image layout.As you can observe,
blake3is roughly 4x ~ 5x faster thansha256.shizhMSFT commentedon Aug 6, 2024
Although
blake3is faster, theblake3is not a NIST approved algorithm. Therefore, I have concerns to useblake3in FIPS scenarios as well as signing scenarios.shizhMSFT commentedon Aug 8, 2024
Note that the above test with the modified
orastool uses theblake3implementation referenced in opencontainers/go-digest. That is, zeebo/blake3.However, unlike the upstream rust implementation, the
zeebo/blake3implementation does not support multi-threading.rchincha commentedon Aug 30, 2024
@shizhMSFT thanks for the experiment. This is another great data point.
tianon commentedon Feb 6, 2025
I think using the
blake3bare name for the digest algorithm that uses the default 256 bits as established by opencontainers/go-digest#61 seems fine and I don't have major objections to adding something about this in the spec to codify it. I think we do have interesting problems here with interpretability, backwards compatibility, cross-digest, etc, but nothing that isn't already an established issue with the ostensibly supported/codified SHA-512. Should we fix those issues, or offer guidance of some kind? Sure. However, I think that's mostly orthogonal here, especially as Blake3 has more interesting reasons for users to choose it than SHA-512 does, so it's really possible this helps exacerbate those issues to the point where they have to be hammered out (or get hammered out with the benefit/pain of production usage).In short, +1 to optional support for
blake3:referring to the 256-bit implementation in the spec itself.wking commentedon Feb 19, 2025
#1240 is in flight to register
blake3as an optional (MAY implement) digest algorithm.tianon commentedon Apr 24, 2025
Fixed via #1240