Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115929 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20766 invoked from network); 3 Sep 2021 13:27:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2021 13:27:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 940A91804E3 for ; Fri, 3 Sep 2021 07:04:21 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.0.0/20 X-Spam-Virus: No X-Envelope-From: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 3 Sep 2021 07:04:21 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4CF535C01AE for ; Fri, 3 Sep 2021 10:04:20 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Fri, 03 Sep 2021 10:04:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=tHqVi9 NiQgFxgYsUR5EAMxovydMyoQ7LtUTRBmYBfXE=; b=pfBCvqHDLijNtrdWfAqOBt XoQhO/sfqD9C6S8nThhvjv540YJ7y+0JbbUIAhycxwvnVcNU1aJ9pY3fAVECEwK5 BHtNLQHyhj5lyhUMz2WK71XZasPxJ/pYrdZvHpkdxh/ecuQgAAc+g43WPF8/FSD4 by8YO4w9balBJpfIPZYkKavpv7fRGsJhlSZ8alIDwwBhdyVprjPGG02/5KwilBya RRic+P6Y7BmuG16AkZXwTcPotbQlTjdCPWiF/pW17mF6ffyi2DFM6NjnZSlwaClq 30TiyrKV0gWgZvfrzZqxQe3gtkWVF/hNz0qvOyt2pu8MonG80J7ycc5Yq3YHkIdg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvjedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id F1BA1AC0362; Fri, 3 Sep 2021 10:04:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1126-g6962059b07-fm-20210901.001-g6962059b Mime-Version: 1.0 Message-ID: In-Reply-To: References: <6921b613-d993-4e5b-82a7-60e3c9b3df38@www.fastmail.com> Date: Fri, 03 Sep 2021 09:03:58 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Random Extension 3.0 From: larry@garfieldtech.com ("Larry Garfield") On Fri, Sep 3, 2021, at 8:55 AM, Go Kudo wrote: > Thank you. > > > Why is the number generator a parent class rather than an interface? > > This is an implementation limitation. I could not find a way to define my > own object handler in interface. > As Nikita pointed out in a previous suggestion, the NumberGenerator now > uses php_random_ng_algo_user to generate random numbers faster than before, > even if it is a userland implementation. I'm still unclear how I'd write my own NumberGenerator right now. I mean, I can extend the class, but I don't have a sense for what I'd do with it for non-testing/trivial implementations. You say it's using an internal function to generate numbers, but in user space what would I do with that? And when/why would I? > > You don't mention the CSPRNG functions at all. > > This is a mistake. I have corrected it. Thanks! I'm still not clear on the intent here. Is the intent that I should stop using random_int()? And if so, replace it with... what? Do I have to supply a specific non-default generator? That makes the usability worse, and more likely to be gotten wrong. Also, in future scope you you have this sentence, which makes little sense: >> Replace random_bytes() with random_bytes() for random numbers used in shuffle(), str_shuffle(), and array_rand(). --Larry Garfield