Re: [RFC] [DISCUSSION] Reliable user-land CSPRNG

From: Date: Tue, 24 Feb 2015 21:50:48 +0000
Subject: Re: [RFC] [DISCUSSION] Reliable user-land CSPRNG
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-83703@lists.php.net to get a copy of this message
Padraic, >>> Technically, it will be harder than uniqid() if producing strictly >>> random bytes (if output needs to be printable/readable). >>> That's not a "bad" thing obviously! >> >> Sure. But does that indicate the need for a "random_string()" function? > > It would be more random than a stream of 0-9 integer characters, and > probably useful compared to base64'ing a byte stream. I'm afraid to go > survey how its done in the wild right now. Possibly? I've done it two ways: Bitmasks: https://github.com/ircmaxell/RandomLib/blob/master/lib/RandomLib/Generator.php#L228 String of characters: https://github.com/ircmaxell/random_compat/blob/master/lib/random.php#L147 I think the latter is the easiest, especially if we define constants with "normal" char lists: "ALPHA", "ALPHA_NUMERIC", "BASE64", etc and default to "ALPHA_NUMERIC"... Tho I am sure there are other ways out there. Anthony

« previous php.internals (#83703) next »