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

Re^2: setting PERL_PERTURB_KEYS & PERL_HASH_SEED in a perl file

by bart (Canon)
on Jul 17, 2016 at 08:13 UTC ( #1167906=note: print w/replies, xml ) Need Help??


in reply to Re: setting PERL_PERTURB_KEYS & PERL_HASH_SEED in a perl file
in thread setting PERL_PERTURB_KEYS & PERL_HASH_SEED in a perl file

But I think it's important to point out that hash ordering has always been random, even though older Perls used to return hash keys with some consistency to the ordering, leading to code sometimes relying on this fact. But at least since v5.18.0 that has changed, see Hash overhaul. The bottom line is, one shouldn't rely on the order hash keys are returned in, in any version of Perl.
Actually it's much older than that. In order to protect perl from some form of DOS attacks, a randomization of key ordering was implemented in perls as old as 5.8.1, so that the next time you run it, you'd most likely get a different keys order for the same hash keys inserted in the same order.

The reason for that is a possible DOS attack over hash collisions (from 2003) which was fixed that same year in October.

  • Comment on Re^2: setting PERL_PERTURB_KEYS & PERL_HASH_SEED in a perl file

Replies are listed 'Best First'.
Re^3: setting PERL_PERTURB_KEYS & PERL_HASH_SEED in a perl file
by haukex (Abbot) on Jul 18, 2016 at 08:43 UTC

    Hi bart,

    Thanks very much for that, I dimly remembered there had been a change in the past (hence the "at least"), I just didn't think to check perl581delta ;-)

    Regards,
    -- Hauke D

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1167906]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-12-15 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (419 votes). Check out past polls.

    Notices?