http://www.perlmonks.org?node_id=795573

baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:

hi,

i have a bit technical question. hashing in Perl is a very practical tool, but now i'm interested to learn a bit more about it. what type of hashing stands behind the hash 'function', is it a "General Hash Function Algorithms 0.0.1" or...

where can i learn more about Perl hashing (and i don't mean how to hash some data but rather what happens when i hash a string of characters, integer... , what is the complexity of retrieving hash data and so on...).

thank you

baxy

Update: ok thank you when i study recommended references i'll come back with more questions

thank you

  • Comment on implementation of perl hashes, what type of hashing system is used

Replies are listed 'Best First'.
Re: hash function what type of hashing system is used
by dHarry (Abbot) on Sep 16, 2009 at 12:10 UTC

    Some pointers: I found How Hashes Really Work very useful. The article also contains some interesting links like this article by Bob Jenkins (A must read IMHO). If you really want to know the gory details you can dig into the C-code (see for example hv.c).

    enjoy;)

Re: hash function what type of hashing system is used
by almut (Canon) on Sep 16, 2009 at 12:03 UTC

    In case you want to learn more about what Perl is exactly doing when accessing hashes, the source code would be one place to start (in particular hv.c).

    If you're more interested in a general discussion, you could try Bob Jenkins' site — there are some interesting reads to be found, e.g. Hash Functions for Hash Table Lookup   (probably best to start with the latter, and then dig into the code once you have a clearer idea of what you're looking for).

Re: hash function what type of hashing system is used
by ikegami (Patriarch) on Sep 16, 2009 at 12:53 UTC

    where can i learn more about Perl hashing (and i don't mean how to hash some data [...])

    Then don't use the term "hashing". You want to learn more about the implementation of Perl hashes, not "Perl hashing". The simple answer is that they're an implementation of a hash table. More in-depth answers have already been given.

    what is the complexity of retrieving hash data

    The average complexity for fetching, inserting and deleting is O(1).