Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The hash seed is changing each time:


Remember that a hash is mapping an arbitrary string into one of a finite number of buckets. Hash collisions are common, and so for two keys that hash to the same value, their contents will be found somewhere down in a linked list of values hanging off the bucket.

The orginal attack was that one could concoct a series of keys that kept hashing to the same bucket. The post-5.8.1 hash seed initialises a constant in the hashing algorithm, which makes different buckets get used. But if you're using the same data, they'll follow a different but equivalent bucket usage, and so will appear "in the same order" when you pull them out again. You need something fairly low-level to view the buckets and SVs hanging off each one. I'm not sure off-hand what can be used: Devel::Peek doesn't go far enough.

At another level, there is code in place to detect when single-bucket allocation is occurring, and then the hash is rehashed to break up the list across many buckets. Since your data is insufficiently pathological, you're not seeing the rehashing occurring from run to run.

At least, I think that's what's going on...

• another intruder with the mooring in the heart of the Perl

In reply to Re^2: hash randomization and keys() by grinder
in thread hash randomization and keys() by dug

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2023-10-02 09:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found