On Fri, 19 Jan 2024 at 18:43, Hans Henrik Bergan <h...@loltek.net> wrote:
> Can we add the BLAKE3 hash? > > Created a PR here: https://github.com/php/php-src/pull/13194 > > BLAKE3 is a very fast ("blazing fast") cryptographically secure hash. It is > the latest iteration of the BLAKE hash, which was a SHA3 finalist~ see > https://github.com/BLAKE3-team/BLAKE3 for more info on BLAKE3. > > In the PR is a portable C implementation, along with optimized ARM-neon and > x86_64 SSE2, SSE41, AVX2, and AVX512 implementations for GCC+unix and > GCC+windows and MSVC (*MSVC is currently only using the portable > implementation, but it should be easy for a developer equipped with MSVC to > enable the optimized implementations. I don't have MSVC personally) > > That means the PR includes ~35 copies of the same algorithm, in > hand-written assembly, optimized for various CPU/compiler/OS combinations. > Which means the PR is hug*e.* > > It would be possible to only ship a subset of them (For example, keeping > just the gcc+unix+SSE2 and gcc+unix+AVX2 and ARM-neon and trash the rest, > would benefit a lot systems in-the-wild, and reduce the size of the PR > substantially) > > It would also be possible to only ship the portable pure C implementation, > but that would also be detrimental to the performance, which is the main > motivator for adding BLAKE3 in the first place. > > But the groundwork to ship them all is already done (see the PR) > > Thoughts? > BLAKE3 has 2 default sizes, BLAKE3_256 and BLAKE3_512. Internally the hashblock size is 512, With other algo's we have added these different hash sizes, would it be possible for you to expose the 2 hash sizes.