Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126221 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 4DC891A00BC for ; Fri, 24 Jan 2025 21:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1737754480; bh=1U15TuaFs/0pZdVQNkZyJsNb3bCBNkbkOYo9PCfNvWo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=lhPIpWh7J2ItEVhqSkIHMQuyiX/vQfY+VVrs44WFmpVsCrsZuPSMCtdtcIFjbNdoI pxZPfd1/hpr9xVRl8iyQuUpvbE/efVHF+i6Vnl3tYvsEo+V1DmFPJyuhbXnqOyAMuJ SOFQQJF0ppCF3xBO96wYRUOUw7Viq0m994ZsVZZTnV2sVd9LAlvz/64beQ0Px3xFum Iq0AZZGOjFXD3TEa4ezS2I6mwBaJjUhS4uIu45HoLoESCljrko2Ux92xhIP/iuxsMF H21tef7n0r2v0HxOCTeYPTvaKUR0i+sX9PaQXNy/S03gOigXbCMbywF4ihhJfVHpR5 QpOSAMumdrnBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6CEB3180078 for ; Fri, 24 Jan 2025 21:34:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_INVALID,DKIM_SIGNED,DMARC_MISSING,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from earwig.ash.relay.mailchannels.net (earwig.ash.relay.mailchannels.net [23.83.222.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jan 2025 21:34:38 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|hans@loltek.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3FE32441FE for ; Fri, 24 Jan 2025 21:37:27 +0000 (UTC) Received: from pdx1-sub0-mail-a288.dreamhost.com (trex-7.trex.outbound.svc.cluster.local [100.117.121.152]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B2032453F3 for ; Fri, 24 Jan 2025 21:37:26 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1737754646; a=rsa-sha256; cv=none; b=Dq2FkNk2BQwhfouPniIlmbzfL5e7+CVB/PmfdHYoEZD+knDeSqW7rjJ/F5fCgyJg5vLnRW riX4Nn6NlrsTcqx2i7l4Q9cQ44CxlN/53hkEqWMCE6E3boOvyW70M5ESrurSQlcRExRcM0 e71V7xUysz2z0bJBu7ZFNZ5LWDG+83uHwzwhx4ttsHe1dX6N3iNSInIG41dC8aFUalGvFF r46aDFlDgptvCvqk4nhQxlETWJJHKZWbxBwV4qJLttm+FotwaFnY0tvKqT8lNP9JImAChf uDZA824RoifgGvBZAdiVY8TFRy4AjfBEbFrvTdkxXfVztfEutpzXIYJKixGs9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1737754646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tCHanRf/acS1D5P6xtMmmYgOi3Ezvm+/4jY7DSd3q6I=; b=UXzbe70rggFs40+iY/Znf1EQTXADrGOoSZx7qIlVfk96CKCi8n+Fi2ZuC1xkYaGcJSGakI KfXA1uPuc/pJKBCARq0e7bbns2xe2Vgt8rJOGhSb0cxWH0XjzoWO3fTt70B+jiQNIts+3U 6kDAOd92XwUx6K5prJLoRyaiPs7VZQiesQhGxfiEUFvKWcyKDQikfKQhZ43Mh6E81RtNqy 8nLyLOReGTznfjetHOZAKAnr4ADfMZwIBCkqQOpRig+JVcyRNjiEtr+ooPc6TsaJPtEZWR XaQkF9g0OvauTQug87yEWWWYWw7K6fTHoHWcCNrdqReIwWk4SbYjcK6euYlXhw== ARC-Authentication-Results: i=1; rspamd-7d9c9fccdc-4d4mc; auth=pass smtp.auth=dreamhost smtp.mailfrom=hans@loltek.net X-Sender-Id: dreamhost|x-authsender|hans@loltek.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|hans@loltek.net X-MailChannels-Auth-Id: dreamhost X-Suffer-Shelf: 4c3567b61dd80302_1737754646931_4266619838 X-MC-Loop-Signature: 1737754646930:4021858838 X-MC-Ingress-Time: 1737754646930 Received: from pdx1-sub0-mail-a288.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.117.121.152 (trex/7.0.2); Fri, 24 Jan 2025 21:37:26 +0000 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hans@loltek.net) by pdx1-sub0-mail-a288.dreamhost.com (Postfix) with ESMTPSA id 4YfrkZ4GZZz75 for ; Fri, 24 Jan 2025 13:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=loltek.net; s=dreamhost; t=1737754646; bh=+Tt+pf+4M4m3da/Y00ayZu5seaSU2wFGqMqQbQ2Ehxs=; h=From:Date:Subject:To:Cc:Content-Type:Content-Transfer-Encoding; b=Ivz06SqdplsVi9RCQu6/JgLMZH2CutoONoaSPvs1cyUVigh2P/K3usQ9o7sD+lSmh iwArlvOgAdlPryfy4TwsIMrtHtPc43fuMl17m5QvzcGS2V+kzl0oC9lP4J5zJ7KmEY BvCgxOAsvK+sB4zpGH8qcMYHPO3e5p3npOXeDVrbIwZgaMUinFPDniRvfkP+QueesV Fl20UUtXXHsk0zfoUW4Dqc8eaG6ANxDg44tCJm5ws+VNenqDMBqxzKxBCYbeybAJHZ 713Z/N5abmm1RPVYOclt4KLu0eGaItiWlxaegXSP5ChhxvoGt8/wvzcaqCH0kQHXTa 0GOcC0otAl3ng== Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2ef87d24c2dso3667927a91.1 for ; Fri, 24 Jan 2025 13:37:26 -0800 (PST) X-Gm-Message-State: AOJu0YzakeMQ7JmXYeTMqlUwCJPlVmZ6sKoC2CEInmcH44Ig3OqqzMVM JsrKedZu/rPWMgKuWg+aDPSfL9xFr21oA0sAI/6I/brPeTij8oqkxFtfGr0nTI5f1GdzSrm2Rz3 3deekoOXQUB0gTLIFjDAhSQKkZl0= X-Google-Smtp-Source: AGHT+IElEJb9YtSRlCBWjVhDlQhtxIndmtgHoImhNqf0wV9QnzzmNm2Gw1WNc7zkoAxUPNmbjPrbGsTpsbGLzCPPyq8= X-Received: by 2002:a17:90b:53c6:b0:2ee:edae:780 with SMTP id 98e67ed59e1d1-2f782cb4d32mr47019084a91.15.1737754646247; Fri, 24 Jan 2025 13:37:26 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <995b9de75fc45af9b4afc327977b3ed8@bastelstu.be> In-Reply-To: <995b9de75fc45af9b4afc327977b3ed8@bastelstu.be> Date: Fri, 24 Jan 2025 22:37:14 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: AWEUYZkqi7kg2jQ1HAGVHZqJN7LMsw33fILgN3qY9IOUSx_E2j-nzXtGyLz_ceE Message-ID: Subject: Re: [PHP-DEV] BLAKE3 hash redux To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: hans@loltek.net (Hans Henrik Bergan) On Fri, 24 Jan 2025 at 21:54, Tim D=C3=BCsterhus 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/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/hash/bench.php highlight BLAKE3's performance: it > > is over four times faster than SHA3-256 on AMD Ryzen 9 7950x: > > https://wiki.php.net/_detail/rfc/output_5_.png > > Thank you for your RFC. I'm a little confused by the benchmark results. > According to > https://www.amd.com/de/products/processors/desktops/ryzen/7000-series/amd= -ryzen-9-7950x.html, > the Ryzen 9 7950x should support SHA-NI, which should make SHA-256 much > faster than SHA-1. On my i7-1365U I get SHA-256 results that are > competitive with BLAKE3 and with SHA-256 being a well-established > algorithm, the benefit of having BLAKE3 becomes much smaller when also > considering that will likely remain under much less scrunity of the > cryptographic community. BLAKE3 keeping up with dedicated SHA CPU instructions (i.e SHA-NI) is impressive. ARM is getting more and more common, and I don't think ARM has SHA instructions (yet?) tho. BLAKE3 offers security superior to SHA2 and comparable to SHA3, among the 3, only SHA2 is vulnerable to length extension attacks. > blake3 0.010877 > sha3-256 0.052112 On your system, it seems BLAKE3 is 4.7 times (almost 5 times?) faster than sha3-256, interesting. > Is your benchmark perhaps not reflecting the latest changes with PHP > 8.4? SHA-NI support was added in > https://github.com/php/php-src/pull/15152. ah yes, the benchmarks is from commit https://github.com/php/php-src/pull/13194/commits/187c8e96383bf3b792c45a476= 9c6f795db0e86a6 dating to 19 january 2024 (the benchmark is in the commit message), 6 months prior to https://github.com/php/php-src/pull/15152 ... I tried getting BLAKE3 added back in january 2024, but ran out of steam= . > As for the RFC itself: I suggest to already add the (closed) voting > doodle to the proposed voting choices section. The way the section is > currently worded doesn't make sense, because it implies two distinct > votes. like this I guess: * Yes * No added.