HomeDevCentral

Use cryptographically secure pseudo-random integers
b06cf75ecc00Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.
This commit has been deleted in the repository: it is no longer reachable from any branch, tag, or ref.

Description

Use cryptographically secure pseudo-random integers

Summary:
Methods from Identifiers\Random were currently implemented using
the Mersenne Twister general-purpose pseudorandom number generator.

As randomness is often used as a source to generate credentials,
and to also offer unbiaised results for games, this changes switch
to the CSPRNG method random_int. The random_bytes method was already used.

According PHP manual, the "cryptographically secure pseudo-random number
generator (CSPRNG) API provides an easy and reliable way to generate
crypto-strong random integers and bytes for use within cryptographic contexts."

As our library is PHP 7+ (actually PHP 8.1+), the CSPRNG methods are always
available.

Test Plan: Run unit tests, no regression detected.

Reviewers: dereckson

Reviewed By: dereckson

Differential Revision: https://devcentral.nasqueron.org/D2656

Details

Provenance
derecksonAuthored on Apr 9 2022, 12:04
derecksonPushed on Jul 1 2023, 20:39
derecksonPushed on Jun 22 2023, 22:00
Parents
rKERUALD57b6d3486952: Update license information
Branches
Unknown
Tags
Unknown

Event Timeline