By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,825 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,825 IT Pros & Developers. It's quick & easy.

True random device and PHP

P: n/a
Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8

TIA
Pjotr
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers" <x3****@westerterp.com>
wrote:
Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
This is what i am using currently (i always check the DB for dupes first) --

$random = md5 (uniqid (rand()));

I have never had a duplicate alpha-numeric random yet and i am up to 500,000
Phil

Andy Hassall <an**@andyh.co.uk> wrote in message news:<ar********************************@4ax.com>. ..
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers" <x3****@westerterp.com>
wrote:
Does anyone know how one can get values from the on-chip random device on
modern Intel processors using PHP ? I am using a windows (XP) based system,
PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.

Jul 17 '05 #3

P: n/a
Andy Hassall wrote:
On Sat, 2 Oct 2004 14:17:29 +0200, "Pjotr Wedersteers"
<x3****@westerterp.com> wrote:
Does anyone know how one can get values from the on-chip random
device on modern Intel processors using PHP ? I am using a windows
(XP) based system, PHP 4.3.8


The information on this page:

http://home.comcast.net/~andrex/hardware-RNG/index.html

... came as a bit of a surprise. Looks like Intel have stopped putting
hardware RNGs in their chips.


I already feared the RNG at least was not going to be widespread. This news
simply deflates any hopes I might have had of using it in my programs.
Thanks for this link Andy.

Pjotr
Jul 17 '05 #4

P: n/a
Phil Palmieri wrote:
This is what i am using currently (i always check the DB for dupes
first) --

$random = md5 (uniqid (rand()));

I have never had a duplicate alpha-numeric random yet and i am up to
500,000

This method is far from random, even when you haven't got one single
duplicate yet.
uniqid () is based on microtime (i.e. predictable) and rand () does not
exceed the range of an integer.
Also rand() which stems from the original libc branch is considered slow and
not very random indeed.

If you need something more random u might check out the mt_rand() function
(mt stands for Mersenne Twister, after the algorithm used for producing
random values).

For good randomness in cardgames sims I need either a true random source or
a pRNG with a range way higher than rand(). Most cardgame sites use advanced
PRNG's mixed with random info such as user mouse movement data, timeout
values et cetera.

Of course all this is not required for simple usage, but for some uses (such
as commercial pokerware) it simply won't do. Thanks for your input too Phil!

Regds
Pjotr
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.