" David" <dn...@netiq.com> wrote in message news:eaSF3rjOBHA.1552@tkmsftngp03...
1) Perl uses this one: h = 33*h+c where h = current hash and c = current
character. Start h at any value you want & iterate over your strings. This
one has the advantage of speed, the disadvantage that permutations of a
string will all hash to the same value.
2) CRC-32 - nearly as fast as the Perl hash, but more effective - fewer
undesirable properties. You can find code for CRC-32 all over the net -
just look.
3) SHA(1) or MD5 - Cryptographically strong hashes. The code for these is
not trivial, and the hashes they generate are large (160 bits or more).
Again, search the net for code. Crypto++ has implementations of both.
No hashing algorithm is "best" for every application - choose one which
meets your needs. No hashing algorithm will guarantee uniqueness - that's
anathema to the whole idea of hashing. Better hashes simply increase the
chance of uniqueness.
-cd
" David" <dn...@netiq.com> wrote in message
news:eaSF3rjOBHA.1552@tkmsftngp03...
Hi every one,
" David" <dn...@netiq.com> wrote in message news:eaSF3rjOBHA.1552@tkmsftngp03...
"Bill Davy" <Bi...@SynectixLtd.com> wrote in message news:eGjn7.11007$a74.50744@NewsReader...