rfc:improve_predictable_prng_random
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:improve_predictable_prng_random [2017/02/03 04:15] – Explicitly explain BC in PHP 7.1 yohgaki | rfc:improve_predictable_prng_random [2017/02/03 04:34] – Fix function signature yohgaki | ||
---|---|---|---|
Line 58: | Line 58: | ||
==== Rack of Reseeding ==== | ==== Rack of Reseeding ==== | ||
- | Reseeding is important for PRNG to mitigate guessed random value. Since MT rand is predictable PRNG, using the same PRNG state allows to guess random value. Current PHP only supports very weak initialization and keeps using the same PRNG state once it is initialized. This behavior makes trivial to guess MT rand generated random numbers. | + | Reseeding is important for PRNG to mitigate guessed random value. Since MT rand is predictable PRNG, using the same PRNG state allows to guess next random value easily. Current PHP only supports very weak initialization and keeps using the same PRNG state once it is initialized. This behavior makes trivial to guess MT rand generated random numbers. |
To resolve this issue, PHP should reseed MT rand when state is used certain number of times. | To resolve this issue, PHP should reseed MT rand when state is used certain number of times. | ||
Line 86: | Line 86: | ||
<code php> | <code php> | ||
- | int mt_rand([RandomState | + | int mt_rand([RandomMT |
- | int mt_rand(int $min, int $max [, RandomState | + | int mt_rand(int $min, int $max [, RandomMT |
- | int rand([RandomState | + | int rand([Random |
- | int rand(int $min, int $max [, RandomState | + | int rand(int $min, int $max [, Random |
- | bool shuffle(array &$arr [, RandomSatate | + | bool shuffle(array &$arr [, Random |
</ | </ | ||
rfc/improve_predictable_prng_random.txt · Last modified: 2018/03/01 23:13 by carusogabriel