standard library for hash table storage and hash algorithm

Discussion in 'C Programming' started by Pieter Claassen, Aug 4, 2004.

  1. Is there any reasonable standard hash table storage in C on Linux?

    AFAICT the one in glibc has a data struct where the key and value pairs
    both have to be null terminated pointers. In my case, that is fine for the
    key, but I need to store a complex struct as the value and short of doing
    dangerous things like printing the memory location of the value struct and
    then recasting it when I want to get to the struct (which I think is
    dangerous), I don't want to use non-standard libraries.

    Also, what is a good way to generate a hash from a very large 96bit
    identifier? the linux/hash.h only does longs which is a 32 bit number on
    my machine.

    Any help appreciated.

    Thanks,
    Pieter
    Pieter Claassen, Aug 4, 2004
    #1
    1. Advertising

  2. Pieter Claassen

    CBFalconer Guest

    Pieter Claassen wrote:
    >
    > Is there any reasonable standard hash table storage in C on Linux?
    >
    > AFAICT the one in glibc has a data struct where the key and value
    > pairs both have to be null terminated pointers. In my case, that
    > is fine for the key, but I need to store a complex struct as the
    > value and short of doing dangerous things like printing the memory
    > location of the value struct and then recasting it when I want to
    > get to the struct (which I think is dangerous), I don't want to
    > use non-standard libraries.
    >
    > Also, what is a good way to generate a hash from a very large
    > 96 bit identifier? the linux/hash.h only does longs which is a
    > 32 bit number on my machine.


    In reverse order, maybe treat it as a 12 char string? Look up the
    hash references in the following.

    hashlib is completely standard portable C. Available under GPL
    at:

    <http://cbfalconer.home.att.net/download/>

    --
    "I'm a war president. I make decisions here in the Oval Office
    in foreign policy matters with war on my mind." - Bush.
    "Churchill and Bush can both be considered wartime leaders, just
    as Secretariat and Mr Ed were both horses." - James Rhodes.
    CBFalconer, Aug 4, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steve.leach

    How standard is the standard library?

    steve.leach, Apr 18, 2005, in forum: Python
    Replies:
    1
    Views:
    388
    Christos TZOTZIOY Georgiou
    Apr 18, 2005
  2. funkyj
    Replies:
    5
    Views:
    1,122
    funkyj
    Jan 20, 2006
  3. sarathy
    Replies:
    2
    Views:
    659
    sarathy
    Jul 17, 2006
  4. rp
    Replies:
    1
    Views:
    512
    red floyd
    Nov 10, 2011
  5. Simon Hardy-Francis
    Replies:
    2
    Views:
    59
    Rustom Mody
    Mar 23, 2014
Loading...

Share This Page