On Wednesday, May 15, 2002, at 11:24 , Postman Pat wrote:

> Greetings,
> I would like to create get some random stuff using /dev/urandom. What I
> was thinking is using stuff from urandom as the random seed and using the
> normal rand stuff from perl?

how exactly were you planning to read /dev/urandom?
It exists on the darwin and linux OS's - but not on
the solaris OS - so you would be making your code
less portable by starting out with a raw read of
a device....

Traditionally we have always seeded Rand from a time() call.
That way you know that you are not seeding from a constant.

> Any ideas how I could code this, or is there a better way of actually
> getting random stuff.


you might want to check

        perldoc -f srand

which asserts

        "uses a semi-random value supplied by the kernel
         (if it supports the /dev/urandom device)"

which based upon the

        perldoc -f rand

documentation suggest that if your OS has the capabilities,
then rand will seed from srand by default unless you
apply an EXPR ....

Not that I would want to prevent you from writing the XS
that would allow you to directly call the vol 3 library
calls in the linux environment for doing this... since
hey it would be cool to have the initstate() and setstate()
library calls.... but I clearly would want to put the
request in that your Perl Module also have a way to make
sure that the kernel has been properly seeded - he said
being somewhat gratuitous....

Alternatively you may want to look at say apple's
cryptographics support and their 'entropy engine'
where this sort of need for random key generation
is reasonably important...


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to