Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-02-02 Thread Go Kudo
Hi Alex First, let me apologize for my poor English skills. It may contain rude expressions, but it is not s intentional. > The closest library I know and used when I had that need you mentioned is a userland implementation: https://github.com/paragonie/RandomLib This seems to be actively

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-27 Thread Alexandru Pătrănescu
On Tue, Jan 26, 2021 at 8:06 PM Go Kudo 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

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-26 Thread Go Kudo
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

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-24 Thread Go Kudo
Hi internals. RFC has been updated to 1.3 and implemented. https://wiki.php.net/rfc/object_scope_prng The main changes are as follows: - `RNG\OSRNG` has been renamed to `RNG\OS`. This was too verbose. - `rng_rand()` has been renamed to `rng_int()` and the arguments `$min` and `$max` are now

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-19 Thread Go Kudo
> but I don't think rng_rand() should support calling without arguments. This is a backwards-compatibility leftover in mt_rand() and we should not carry it over into a new API. While this is true, the current implementation of MT in PHP relies on global state, and I believe that having a

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-19 Thread Marc Bennewitz
Am 19.01.21, 17:20 schrieb "Nikita Popov" : * 64-bit: I looked over your implementation, and I think your approach to handling 64-bits is correct. You only call next64() if the requested range is larger than 32-bit, and that can only happen on 64-bit systems, thus guaranteeing

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-19 Thread Go Kudo
Yes. RNG stands for Random Number Generator, which I think is a common acronym. Cryptographic pseudo-random number generators are commonly known as a CSPRNG. 2021年1月19日(火) 1:42 Kamil Tekiela : > What does rng stand for? Is it short for range or acronym of random number > generator? >

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-19 Thread Nikita Popov
On Mon, Jan 18, 2021 at 5:29 PM Go Kudo wrote: > RFC and implementation updated. > > https://wiki.php.net/rfc/object_scope_prng > https://github.com/php/php-src/pull/6568 > > > MT19937 returns a signed 32bit number as a result of the `next()` method; > the mt_rand() function returns a

Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-18 Thread Kamil Tekiela
What does rng stand for? Is it short for range or acronym of random number generator?

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-18 Thread Go Kudo
RFC and implementation updated. https://wiki.php.net/rfc/object_scope_prng https://github.com/php/php-src/pull/6568 > MT19937 returns a signed 32bit number as a result of the `next()` method; the mt_rand() function returns a bit-shifted unsigned 31bit number, so the results are not identical.

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-17 Thread Go Kudo
Updated the RFC and fixed the implementation. Also made some additions to the RFC about when this feature might be useful. RFC: https://wiki.php.net/rfc/object_scope_prng Implementation PR: https://github.com/php/php-src/pull/6568 (All CI passed) The main points are as follows: - The

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-11 Thread Go Kudo
I have made some fixes to the implementation based on review. The current implementation can be found at the following address (Thanks Tyson: https://github.com/zeriyoshi/php-src/commit/5ff8882a8fbfaf4ffd5cc42fb5853c4a1a00c182 )

[PHP-DEV] Re: [RFC] Object-scope RNG implementation

2021-01-10 Thread Go Kudo
Hi internals. I implemented Type II, which was pointed out by Nikita and fixed. https://github.com/zeriyoshi/php-src/commit/5ff8882a8fbfaf4ffd5cc42fb5853c4a1a00c182 This is much smarter and simpler than Type I, but the implementation is more complex (partly due to my lack of knowledge). It