Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > standard library for hash table storage and hash algorithm

Reply
Thread Tools

standard library for hash table storage and hash algorithm

 
 
Pieter Claassen
Guest
Posts: n/a
 
      08-03-2004
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
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      08-04-2004
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hash of hash of hash of hash in c++ rp C++ 1 11-10-2011 04:45 PM
Is there a hash algorithm with direct access to hash elements andreference count? Bo Peng C++ 4 03-12-2006 05:57 AM
add pexpect to the standard library, standard "install" mechanism. funkyj Python 5 01-20-2006 08:35 PM
How standard is the standard library? steve.leach Python 1 04-18-2005 04:07 PM
Key generation algorithm and Cipher algorithm Ahmed Moustafa Java 0 11-15-2003 06:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57