🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #23262

Re: CRC64 test results

#23262
From: Forrest J. Cavalier III
Date: Fri, 14 Nov 1997 00:00
73 lines
2982 bytes
In article <64gh6g$ob5$1@flea.best.net>, dillon@best.net wrote...
>
>    b   - number of bits in hash
>    n   - number of words in database
>    c   - number of hash collisions that will occur if you attempt to hash n 
>          words and have a b bit hash key, assuming a good hash function.
>
>    c = ( n * (n-1) / 2 ) / 2^b
[snip]


This formula is true only if you start with an empty hash table.
This happens only when you turn the hash system on for the
first time.

As the steady state operating point is reached, the
probability of having a collision is actually close to

                  Number of entries
           ------------------------------
           number of possible hash values     

As with the n * (n-1) formula, the above is actually a
simplification.  It is valid only when the hash table
isn't too full.  As a rule of thumb collision rates below
5% or so won't have much error.  And the output of the
hash function must be evenly distributed.

The practical result is that for steady state conditions
you have to figure on doubling the value you get from the
n * (n-1) formula.

>
>    So, to get one collision with a 64 bit key requires you to hash
>    approximately 6 billion words.

Sure, if you had *only* 6 billion words.  The probability
of a collision is about 1 in 3.0 billion in the steady state
condition.

>
>    To get one collision with a 56 bit key requires you to hash
>    approximately 379M words.

Steady-state probability of collision is about 1 in 190M.

>
>    Isn't this fun ?  I love numbers.
>
>                                                -Matt

And the item which kicked off the thread: being off by
a factor of two in the analysis is not where things usually
break down.  The usual problem is a bad hash algorithm.

Also, what you do with the hash value matters a lot too.
CRC64 is great for an existence check: it makes it very
unlikely that any other article currently in circulation
has the same value.

But you can't have a 2^64 hash table in memory for article
lookup by message ID.  So if that is your purpose, the
value that really matters is the number of slots in the
hash table.

Forrest

Please accept my apologies if I have repeated something
you already know.


Technical Details
Message-ID: <64hmn5$6t9$2@news1.epix.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <64a6pf$ejq$1@flea.best.net> <64b64b$hcb@dfw-ixnews1.ix.netcom.com> <0000346B688D.NO_UCE@mauve.demon.co.uk> <0000346BB22C.NO_UCE@mauve.demon.co.uk> <64gh6g$ob5$1@flea.best.net>

Show Full Headers
Complete Article Headers
Message-ID: <64hmn5$6t9$2@news1.epix.net>
Subject: Re: CRC64 test results
Date: Fri, 14 Nov 1997 00:00:00 +0000
From: mibsoft@epix.net (Forrest J. Cavalier III)
References: <64a6pf$ejq$1@flea.best.net> <64b64b$hcb@dfw-ixnews1.ix.netcom.com> <0000346B688D.NO_UCE@mauve.demon.co.uk> <0000346BB22C.NO_UCE@mauve.demon.co.uk> <64gh6g$ob5$1@flea.best.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 289520299
Organization: Mib Software
Newsgroups: news.software.nntp