Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122637 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 BD91A1AD8F6 for ; Thu, 14 Mar 2024 11:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1710416828; bh=vRXuoJ35cdEikWRLYzT0a6Hl3bQXhKWpF/W0+HiUu6I=; h=Date:Subject:To:References:From:In-Reply-To:From; b=EtOkRSCgaY3fevJjkY//V493CIS5/LRh1bT+7toO0IBjjqtyqIXQ1giqxvLqBOiq+ bhO3GvuZc50MFtMJNk6xmFCl56UVIHmTxW1P1Eg0hy5ilFhVjl4ppSEfYeL58pdJtK kJ3RuMlnIbMgV/Qdh0+uTWO5hMT3PzjZqiN1VZNyKdkIqNj6JZkjrym4i+s+xv0F3L IApapnJSUULoMdaSWDCYPWxl0q6Z6F9awO4moDJYi2WtUJbHskjc4egexyVr55n6QO 9HfSQ82iLUt1sPgNldNJwxeuIhaPRzmt4FhnGGkmxtzCx4a+qsYoJLrE04XfpB/BQg vHmYeoqwWSlSg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9B4B5180074 for ; Thu, 14 Mar 2024 11:47:07 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (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 ; Thu, 14 Mar 2024 11:47:07 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-789db18e169so18501485a.1 for ; Thu, 14 Mar 2024 04:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710416809; x=1711021609; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=OcU1F03so3A9U4ijW3363RBbjiua/1k6bq0YyG5oZ7I=; b=SRb/JzjuRmWLEw8vbxAwN5CW+4wh1le/Htl85hcsqoNQqF7zGF3Dsws/QbyTnnotqN Z3Ly1fBW2n04ABKxLoRXUO16mjMtpJfXgE743drwsgKqHj/H4w4JtV4QcpwhlFb78Mqn wHzo12rVNlP3KT4J1Tgj46WnMfGp8uw922P5duqIf8Y1/AItywEPjZdVAk+OAtvJTp/x Jh6rcrs8xZ/DfXGmqKhAElHhcXfHlciWIH7k/blWOyot8flABYf1q+8OAaQi6ucSXURh bq2TgaoStEFenNrtYbYC5cOhX3jiksQsa3kEBj10N4fTsw6Hilm5jSlvcp9l09/kPDA0 JJvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710416809; x=1711021609; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OcU1F03so3A9U4ijW3363RBbjiua/1k6bq0YyG5oZ7I=; b=Vk7VKuDmp2S9F9tXMfSqQA9/oQCRxSD3kAny8FaMntWJm7oyjH6HzLp4sLZmi9EVye alQ49ApRudAcIbf3OgDH/Ti2rRlxDt/1JFWAACNhQ7u6xj4oyXiO2PVlL8jMieLXTnri 5lGlRgn+lEywUE3OnNx5KJteua+xVKAFp16nCbsEaXEY+zM6TJENN9HAEdiPw5J9g6KU JcpTvHMinI6JP8pVhbq/i3KbdOY1K92PWFYzHmTCZ8QZoy1SvvU1+ZsQD3QTaFO+AEqx 2qSaC9G8TRQ+MO0o9EeKKOqYxiQYMcgaQ9fZKkjFGAr7l9jO7eGIvt0ObAdHbj4t0bfN Fw3w== X-Gm-Message-State: AOJu0Yx9y5LsYRWBsOT+IdpXOSJh83XrmCTU84J77CoupqzCflrH58b0 fEdGJoyJkm7ZS55YI9B9TFDcd4xxY0LqAGhFoSEfXlbf0hRyVMujJl81bmr6 X-Google-Smtp-Source: AGHT+IHyiTmPHhAIHX30XhQa1/tvmGxuNkZqI35Uhw0MWaxET6tgjd+bOUGna6/GsC1HydRYvSpokg== X-Received: by 2002:ae9:e214:0:b0:788:2c33:5694 with SMTP id c20-20020ae9e214000000b007882c335694mr335600qkc.78.1710416809166; Thu, 14 Mar 2024 04:46:49 -0700 (PDT) Received: from ?IPV6:2a02:a45e:66ed:1:45a6:7fed:4990:ad54? (2a02-a45e-66ed-1-45a6-7fed-4990-ad54.fixed6.kpn.net. [2a02:a45e:66ed:1:45a6:7fed:4990:ad54]) by smtp.gmail.com with ESMTPSA id a27-20020a05620a125b00b00789cb269356sm707563qkl.120.2024.03.14.04.46.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 04:46:48 -0700 (PDT) Message-ID: Date: Thu, 14 Mar 2024 12:46:46 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] base64_encode without padding To: internals@lists.php.net References: <9114cbe3-2b9c-4037-856b-20afc8f96f95@FamilleCollet.com> Content-Language: en-US In-Reply-To: <9114cbe3-2b9c-4037-856b-20afc8f96f95@FamilleCollet.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: dik.takken@gmail.com (Dik Takken) On 13-03-2024 17:06, Remi Collet wrote: > I think padding should be optional (on by default to keep BC) > > Of course in user land, simple to write > >   $enc = trim(base64_encode('foo'), '='); > > This proposal allow to simply use > >   $enc = base64_encode('foo', PHP_BASE64_NO_PADDING); > > And also expose it for extension as > >   PHPAPI extern zend_string *php_base64_encode_ex >     (const unsigned char *, size_t, zend_long flags); > > > Use case: for ARGON2 password hashing > see https://github.com/php/php-src/pull/13635 > > It may seems ugly to add and remove th padding char > > Is a RFC needed for such a minor feature ? > > > Remi Great addition! Only I would strongly prefer a boolean argument over a flag. Especially now that we have named arguments, adding a bunch of optional boolean arguments to the signature does not lead to unreadable code anymore. In fact, I think it yields code that is easier to read. Regards, Dik