Re: [RFC] Random Extension 3.0

From: Date: Fri, 03 Sep 2021 14:03:58 +0000
Subject: Re: [RFC] Random Extension 3.0
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-115929@lists.php.net to get a copy of this message
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

« previous php.internals (#115929) next »