Re: [PHP-DEV] BLAKE3 hash redux

2025-01-24 Thread Tim Düsterhus
Hi Am 2025-01-24 22:37, schrieb Hans Henrik Bergan: BLAKE3 keeping up with dedicated SHA CPU instructions (i.e SHA-NI) is impressive. I would assume that that's the AVX2 implementation (my CPU can't AVX512), which makes it less impressive. ARM is getting more and more common, and I don't t

Re: [PHP-DEV] BLAKE3 hash redux

2025-01-24 Thread Christoph M. Becker
On 24.01.2025 at 20:39, Hans Henrik Bergan wrote: > Can we add the BLAKE3 hash? > > Created a PR here: https://github.com/php/php-src/pull/13194 > Created a RFC draft here: https://wiki.php.net/rfc/blake3 I'm *generally* somewhat concerned regarding the amount of code (growth) in ext/hash, which

Re: [PHP-DEV] BLAKE3 hash redux

2025-01-24 Thread Hans Henrik Bergan
On Fri, 24 Jan 2025 at 21:54, Tim Düsterhus wrote: > > Hi > > (Hans, apologies for the duplicate copy, I accidentally did not send the > first reply to the list) > > Am 2025-01-24 20:39, schrieb Hans Henrik Bergan: > > Can we add the BLAKE3 hash? > > > > Created a PR here: https://github.com/php/p

Re: [PHP-DEV] BLAKE3 hash redux

2025-01-24 Thread Tim Düsterhus
Hi (Hans, apologies for the duplicate copy, I accidentally did not send the first reply to the list) Am 2025-01-24 20:39, schrieb Hans Henrik Bergan: Can we add the BLAKE3 hash? Created a PR here: https://github.com/php/php-src/pull/13194 Created a RFC draft here: https://wiki.php.net/rfc/bl

[PHP-DEV] BLAKE3 hash redux

2025-01-24 Thread Hans Henrik Bergan
Can we add the BLAKE3 hash? Created a PR here: https://github.com/php/php-src/pull/13194 Created a RFC draft here: https://wiki.php.net/rfc/blake3 BLAKE3 is a cryptographic hash function based on the SHA3-finalist BLAKE, offering SHA3-256-like security at much higher speed. Benchmarks from /ext/h

Re: [PHP-DEV] BLAKE3 hash

2024-01-29 Thread Hans Henrik Bergan
with https://github.com/php/php-src/commit/52dba99d47563f38d8ed5f84690a3cb2c1785475 , the PR ( https://github.com/php/php-src/pull/13194 ) got the first merge conflict. I fixed it, but what's next? Could vote on it, if there is little more to discuss? quick recap AMD Ryzen 9 7950x: portable -O2

Re: [PHP-DEV] BLAKE3 hash

2024-01-26 Thread Hans Henrik Bergan
just tested ARM Neon optimizations on Oracle Cloud's cheapest ARM VPS: VM.Standard.A1.Flex, Ubuntu 22.04, GCC11.4, results: -O2 portable: 596MB/s -O2 -march=native portable: 601MB/s -O2 ARM Neon optimized implementation: 1138MB/s Again, even with -march=native, the compiler cannot make the portabl

Re: [PHP-DEV] BLAKE3 hash

2024-01-24 Thread Marco Pivetta
On Thu, 25 Jan 2024, 06:22 Hans Henrik Bergan, wrote: > On Wed, 24 Jan 2024 at 17:59, Marco Pivetta wrote: > > > > Depends on the actual numbers: is there any way to make a comparison that > > is relatively stable across architectures? > > > > Would it be feasible to start with the > > cross-pla

Re: [PHP-DEV] BLAKE3 hash

2024-01-24 Thread Hans Henrik Bergan
On Wed, 24 Jan 2024 at 17:59, Marco Pivetta wrote: > > Depends on the actual numbers: is there any way to make a comparison that > is relatively stable across architectures? > > Would it be feasible to start with the > cross-platform-let-the-compiler-do-its-job version (that somebody may > actuall

Re: [PHP-DEV] BLAKE3 hash

2024-01-24 Thread Marco Pivetta
On Wed, 24 Jan 2024 at 17:55, tag Knife wrote: > Should we even be considering the specific instruction implementations? > I've always been in the camp > Depends on the actual numbers: is there any way to make a comparison that is relatively stable across architectures? Would it be feasible to

Re: [PHP-DEV] BLAKE3 hash

2024-01-24 Thread tag Knife
On Wed, 24 Jan 2024 at 16:27, Hans Henrik Bergan wrote: > Maybe vote on it? (that was suggested in the PR too, > https://github.com/php/php-src/pull/13194#issuecomment-1900430400 ) > > Can think of 6 things > > 1: Should BLAKE3 be added to PHP? yes/no > 2: Should ARM Neon (2007) optimized impleme

Re: [PHP-DEV] BLAKE3 hash

2024-01-24 Thread Hans Henrik Bergan
Maybe vote on it? (that was suggested in the PR too, https://github.com/php/php-src/pull/13194#issuecomment-1900430400 ) Can think of 6 things 1: Should BLAKE3 be added to PHP? yes/no 2: Should ARM Neon (2007) optimized implementation be bundled? yes/no 3: Should x86_64 SSE2 (2000) optimized impl

Re: [PHP-DEV] BLAKE3 hash

2024-01-21 Thread Hans Henrik Bergan
On Mon, 22 Jan 2024 at 07:10, tag Knife wrote: > > That's why I suggested implementing separate lengths of the like we have for > SHA3, so we could have BLAKE3_256 and BLAKE3_512 and maybe inbetweens. we can look into exposing blake3's XOF (arbitrary length) capabilities after (and if) initial b

Re: [PHP-DEV] BLAKE3 hash

2024-01-21 Thread tag Knife
On Fri, 19 Jan 2024 at 21:03, Hans Henrik Bergan wrote: > Having looked into it, it seems difficult after all, > I would want a new $options argument for hash_final(), and some > internal changes to struct php_hash_blake3_ops, > and that internal change would have to be updated for all other hash

Re: [PHP-DEV] BLAKE3 hash

2024-01-21 Thread tag Knife
On Mon, 22 Jan 2024 at 02:43, Gina P. Banyard wrote: > On Monday, 22 January 2024 at 02:29, tag Knife > wrote: > > That's why I suggested implementing separate length algorithms like we > have > > for SHA3. > > Just an etiquette note, please don't top post on the mailing list. [1] > I have no id

Re: [PHP-DEV] BLAKE3 hash

2024-01-21 Thread Gina P. Banyard
On Monday, 22 January 2024 at 02:29, tag Knife wrote: > That's why I suggested implementing separate length algorithms like we have > for SHA3. Just an etiquette note, please don't top post on the mailing list. [1] I have no idea what this sentence is replying to, and it makes following the disc

Re: [PHP-DEV] BLAKE3 hash

2024-01-21 Thread tag Knife
That's why I suggested implementing separate length algorithms like we have for SHA3. On Fri, 19 Jan 2024 at 21:03, Hans Henrik Bergan wrote: > Having looked into it, it seems difficult after all, > I would want a new $options argument for hash_final(), and some > internal changes to struct php_

Re: [PHP-DEV] BLAKE3 hash

2024-01-19 Thread Hans Henrik Bergan
Having looked into it, it seems difficult after all, I would want a new $options argument for hash_final(), and some internal changes to struct php_hash_blake3_ops, and that internal change would have to be updated for all other hashes PHP support.. I'm not up for doing that now. And I think it sh

Re: [PHP-DEV] BLAKE3 hash

2024-01-19 Thread Hans Henrik Bergan
>BLAKE3 has 2 default sizes Nope, only 1 canonical size, 256 bits. *BUT* BLAKE3 is XOF, it can be exactly as long as you want it to be: $ echo test | b3sum --length 5 dea2b412aa - $ echo test | b3sum --length 10 dea2b412aa90f1b43a06 - $ echo test | b3sum --length 32 dea2b412aa90f1b43a06ca5e8b8f

Re: [PHP-DEV] BLAKE3 hash

2024-01-19 Thread tag Knife
On Fri, 19 Jan 2024 at 18:43, Hans Henrik Bergan 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 finali

[PHP-DEV] BLAKE3 hash

2024-01-19 Thread Hans Henrik Bergan
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 BLAKE