On Fri, 25 Nov 2005 10:21:54 +0800, "vietor.liu"
<> wrote in comp.lang.c:
Define "best".
> is this?
>
> int hashpjw(char* str,int size)
> {
> unsigned long h=0,g;
> for(unsigned char *p=(unsigned char*)str;*p;++p)
> {
> h=(h<<4)+*p;
> if(g=(h&0xf0000000))
> {
> h^=(g>>24);
> h^=g;
> }
> }
> return h%size;
> }
>
If you want to know the "best" hashing algorithm, ask in
news:comp.programming. And supply a definition of what you consider
to be "best".
Once you have selected an algorithm, if you have problems coding it
correctly in standard C, then you can post your code and description
of your problem here.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html