On Tue, Jan 26, 2021 at 8:06 PM Go Kudo <zeriyo...@gmail.com> wrote:

> RFCs have been reorganized and radically rewritten.
> https://wiki.php.net/rfc/object_scope_prng
>
> The implementation is unchanged, but the background has been explained in
> more detail and the execution speed has been re-verified with PHP 8.1-dev.
>
> The proposal seems to have been received relatively positively by
> externals, but there hasn't been much reaction. I'm unsure when I should
> start voting on this RFC.
>
> Regards,
> Go Kudo
>
> 2021年1月9日(土) 19:00 Go Kudo <zeriyo...@gmail.com>:
>
> > Hi internals.
> >
> > I think I'm ready to discuss this RFC.
> > https://wiki.php.net/rfc/object_scope_prng
> >
> > Previous internals thread: https://externals.io/message/112525
> >
> > Now is the time to let me know what you think.
> >
> > Regards,
> > Go Kudo
> >
>

Hi  Go Kudo,

The closest library I know and used when I had that need you mentioned is a
userland implementation: https://github.com/paragonie/RandomLib, created
by Anthony Ferrara and not maintained by Paragon Initiative Enterprises.
The library is organized nicely with a Generator class that depends on
constructor of a source for randomness. The source has just a simple method
to obtain a specific number of bytes and that's all.

I think the naming is what needs more input here. I'm thinking we can also
have:
- a random bytes source/generator that can be very similar with what you
propose: an interface, multiple internal classes, allowing userland extra
classes.
- a random generator class that would have multiple useful methods like:
randomInt($min, $max), randomFloat(), randomBytes($size),
randomString($size, $possibleCharacters) etc.

As for namings, calling them
- RandomGenerator final class that accepts at constructor a
- RandomSource interface with one method getBytes($size) implemented by
RandomXorShift128PlusSource, RandomMT19937Source, RandomLibsodiumSource,
SecureOsSpecificSource etc.
is a quick idea from me.

State, when is the case, sits in the random source object and can be of
course serialized.

Other than this, initiative looks good.
I apologize if I provided the feedback a bit late.

Regards,
Alex

Reply via email to