Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126220 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 EC7A11A00BC for ; Fri, 24 Jan 2025 20:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1737751904; bh=dF0KR0vSZ/oGwUKxmtfYXFcvU0FMIyrmJrFpaNYhVWQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gahM8B//fJBGMboJ/WNuBDMOJNzDINjO9qE+KwklHwRKhTt+bLUQR/rmrelvoOtfc WYqKaxHPTGI5w30IMLsYCsVVPT9IVVRKtCASJeNVElyeE7xPW8eiECsVT6p4T+SFAP gf682lpbYzJbwP43O9eaNOZ7LruX+g8CGAwekAKcVkrAMzMSEQcBhrVqUbWPd93LA1 VMqlX8wX4LnsdCi98UoetPHxhSoSXsvQBcAjNZykoN2lQjC/uA3CfqPgX0MPujR+tK XesciCKTZbP+/Ccbuqg+Oa6D5W69yrCVHlwJI4TVEzG+aIZoFGxlHE0kspJqv3PhWS sr8Wzd1UAmM9w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C321918007E for ; Fri, 24 Jan 2025 20:51:43 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 20:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1737752071; bh=2aOl5/2EgJ56UB7C4hJIcuAzFbGpHQ3xog58Cf1nveo=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=mwxgdsAdrRk5NSQ0qpndlzRIFnfm+nxQER7oK+uNZ2AXzLCbhIfa1TqGWHhpjvs4k zMh9aAQ0KL9cC0H5wJjJrzS4LyRKvArvjyrWfCnekd8HXnyJtA7Ll+KS+TYvVFtPUT xnh+cG99dPckYspneoBxMQtWUynpCjENA//+Q4rq4A3odqfblUwQN/U3fo4cM86Xs5 z6mHpHmnXYpLar7681PPhlQF4tVDgm3Vw2E/HTJHjhKh0uBN27qX25/H5BrHgWPGNe 79+0FX7RWzuMPRl2MtFpt94JHGnVvhdl4HHE+UY9kWQ6cidj51MVXXNoaW7CXcaLpC Qy/gQ0KCUmn5Q== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 24 Jan 2025 21:54:31 +0100 To: Hans Henrik Bergan Cc: PHP Internals List Subject: Re: [PHP-DEV] BLAKE3 hash redux In-Reply-To: References: Message-ID: <995b9de75fc45af9b4afc327977b3ed8@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) 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. crc32b 0.001059 crc32 0.001060 crc32c 0.001068 xxh3 0.001888 xxh128 0.001915 xxh64 0.002003 murmur3f 0.003031 xxh32 0.003147 murmur3c 0.003590 murmur3a 0.006133 adler32 0.007285 blake3 0.010877 sha224 0.013217 sha256 0.013227 md4 0.017892 fnv164 0.021882 fnv132 0.021941 fnv1a32 0.021953 fnv1a64 0.021960 sha1 0.026227 joaat 0.027386 tiger128,3 0.028267 tiger160,3 0.028301 tiger192,3 0.028335 md5 0.028426 tiger128,4 0.037212 tiger160,4 0.037262 tiger192,4 0.037312 ripemd128 0.037685 ripemd256 0.037950 sha3-224 0.048985 sha384 0.050335 sha512/256 0.050597 sha512 0.050732 sha512/224 0.050744 sha3-256 0.052112 haval160,3 0.059909 haval128,3 0.059922 haval224,3 0.059940 haval256,3 0.060034 haval192,3 0.060077 ripemd320 0.062434 ripemd160 0.062976 sha3-384 0.064828 haval128,4 0.082339 haval192,4 0.082374 haval160,4 0.082414 haval224,4 0.082511 haval256,4 0.082513 sha3-512 0.093178 haval128,5 0.104438 haval160,5 0.104576 haval256,5 0.104610 haval192,5 0.104631 haval224,5 0.104929 whirlpool 0.108009 gost 0.243599 gost-crypto 0.243799 snefru 0.595979 snefru256 0.596615 md2 1.752960 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. 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. Other than the above, I don't have a strong opinion either about the RFC. I don't see much benefit of having it, but also not much against. Best regards Tim Düsterhus