Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Hashes aren't being differently randomized

by Hue-Bond (Priest)
on Jun 26, 2006 at 17:28 UTC ( [id://557616]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perldoc -f each
      each HASH
        Entries are returned in an apparently random order. [...] Since
        Perl 5.8.1 the ordering is different even between different
        runs of Perl for security reasons (see "Algorithmic Complexity
        Attacks" in perlsec).
    
  2. or download this
    $ PERL_HASH_SEED_DEBUG=1 perl -e 'my %a=0..299; print $_ for each %a' 
    +| md5sum
    HASH_SEED = 3379561142
    b6d67a24906e8a8541291882f81d31ca  -
    $ PERL_HASH_SEED_DEBUG=1 perl -e 'my %a=0..299; print $_ for each %a' 
    +| md5sum
    HASH_SEED = 4068799219
    b6d67a24906e8a8541291882f81d31ca  -
    
  3. or download this
    $ PERL_HASH_SEED_DEBUG=1 perl -e 'my %a=0..299; print $_ for keys %a' 
    +| md5sum
    HASH_SEED = 1151419008
    dd56233cf84603df0d47d272da1af003  -
    ...
    $ PERL_HASH_SEED_DEBUG=1 perl -e 'my %a=0..299; print $_ for values %a
    +' | md5sum
    HASH_SEED = 788024661
    c1a75ab8e3bf1ff6c07b01025a1219e9  -
    
  4. or download this
    $ echo $RANDOM
    8035
    $ echo $RANDOM
    ...
    $ PERL_HASH_SEED=$RANDOM PERL_HASH_SEED_DEBUG=1 perl -e 'my %a=0..299;
    + print $_ for values %a' | md5sum
    HASH_SEED = 30449
    c1a75ab8e3bf1ff6c07b01025a1219e9  -
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://557616]
Approved by Corion
Front-paged by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found