Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124631 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 774981A00B7 for ; Fri, 26 Jul 2024 23:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722038419; bh=4j04aYGNjOE5AyGtfB7wdzK6vu85gALh7jRKiyCoa0I=; h=Date:Subject:To:References:From:In-Reply-To:From; b=UJbaUuSmVEfa6BBIF5PhtUnYBOkN/YwVXxgJK56+AjRvehz38XECXPpwXARPLZRgE ELqtOeWGNUBUxBWTERG8fI4ok7XoipeyqpoHmmcrfdTH7fGJEquSDLGWsBckno4Rj7 5HfFHTUjBtPdWdJlUDsOUZOCJl/QQMxaAhf5/cjaykFrl+/UItZCCYFx1yxYpR4avC 2lVcJ+O5pU8yU/45KV8pyIlCUiGRGjauLpt/hyFNGstAAIDJZrwQq7j+bfZDpWzthQ tr5ZHdtX5NyLAcZUu4p8SKTtnzdQJdhxzUccL+EsNb9XFmxaF/2u+p4Ssxw3okHUbX QosHVr5AkWtTA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6289A180054 for ; Sat, 27 Jul 2024 00:00:17 +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.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from jessie.smtp.mailx.hosts.net.nz (jessie.smtp.mailx.hosts.net.nz [43.245.52.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 Jul 2024 00:00:16 +0000 (UTC) Received: from 125-237-145-229-fibre.sparkbb.co.nz ([125.237.145.229] helo=[192.168.1.68]) by jessie.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1sXUpY-00Gpgw-2c for internals@lists.php.net; Sat, 27 Jul 2024 11:58:36 +1200 Message-ID: <3563cf9b-8eab-4c82-b525-a5d2f9a767bb@varteg.nz> Date: Sat, 27 Jul 2024 11:58:17 +1200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] [VOTE] Deprecations for PHP 8.4 To: internals@lists.php.net References: <1a88918e-e808-d778-45e1-53797660e093@php.net> Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Hosts-DKIM-Check: none From: weedpacket@varteg.nz (Morgan) On 2024-07-26 09:34, Rowan Tommins [IMSoP] wrote: > On 24/07/2024 23:01, Morgan wrote: >> And they would still be available as hash("md5") and hash("sha1"); the >> only reason they're called out as their own distinct functions today >> is historical inertia. > > > I don't agree that the reasons for including standalone functions are > "historical". The RFC itself gives a good reason for having such functions: > By "historical" I mean just md5() was in PHP in version 3, sha1() was added in 4.3, and hash() (via PECL) in 5.1.2. md5(), md5_file(), sha1(), and sha1_file() could have been deprecated when hash() became a core PHP extension in version 7, and now (or when looking at targeting 9) would have been about when we'd be discussing removing them. I'm not talking about the MD5 or SHA1 algorithms or whether they should or shouldn't be used. I'm just talking about the functions themselves. md5(), md5_file(), sha1(), and sha1_file(). They only exist because there wasn't the generic hash algorithm extension when they were created. Why do they get this special treatment today? (PS: crc32b also implemented via hash() as well as having its own function.) > > A new user being told "don't use sha1(), use hash() and pick from this > list" is more likely to say "ah, there's sha1, jolly good" than spend an > afternoon reading cryptography journals. There's no pit of success to > fall into. > A new user skimming through the list of string functions is likely to see see "md5()" there and think "ah, there's a hash function, jolly good".