srand in OpenSRS.pm

From: James H. Cloos Jr. (cloos@jhcloos.com)
Date: Wed Apr 12 2000 - 23:42:03 EDT


OpenSRS.pm has this in it:

        # start random generator for Crypt::CBC
        srand( time() ^ ($$ + ($$ << 15)) );

Starting with Perl 5.004, according to perlfunc(1), it is better to
leave off that argument to srand. On a system like Linux or FreeBSD
with a /dev/urandom and/or /dev/random, that will be used. Else, a
hash of process id and other values will be used.

Also, srand, sans arg, is called by default the first time rand is used.

As such, commenting out that line will probably improve the randomness
on modern version of perl running on modern OSes.

-JimC

-- 
James H. Cloos, Jr.  <URL:http://jhcloos.com/public_key> 1024D/ED7DAEA6 
<cloos@jhcloos.com>  E9E9 F828 61A4 6EA9 0F2B  63E7 997A 9F17 ED7D AEA6
        Save Trees:  Get E-Gold! <URL:http://jhcloos.com/go?e-gold>



This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:35:27 EDT