Article View: news.software.nntp
Article #57560Re: Using Message-ID to store binary file information
From: Klaas
Date: Sat, 23 Mar 2002 00:58
Date: Sat, 23 Mar 2002 00:58
152 lines
7824 bytes
7824 bytes
Curt Welch <curt@kcwc.com> wrote in message news:20020322184519.366$du@newsreader.com... > andrew@supernews.com wrote: > > this problem is known in the trade as the "birthday paradox". > > > > (If you assume that birthdays are evenly distributed through the year, > > you only need to get 23 people before you have a better-than-even chance > > that two of them have birthdays on the same day.) > > > > In general terms if you have N hash slots, the number of items K that > > you need to have an even chance of collision varies as sqrt(N). Putting > > that in binary terms means that you need at least twice as many bits of > > hash as you might otherwise expect. > > That doesn't apply to this application. Or it might, depending on > how you are thinking about it. But lets not get confused (if that's > possible :)). > > The birthday paradox only applies when you have a fixed sized set and > you are trying to avoid a hash collision between ANY of them. That would > apply here to the problem of trying to use a hash to uniquely identify > ALL files posted to Usenet (or posted to a single group) within a > timeframe. But isn't that necessary? The case you present below makes sense, but on average, aren't _all_ files downloaded by some user? And is it not likely that for all files, at least one user will be missing one or more parts? I think it is likely that every file will be checked against every other file (in the group, at least) if this scheme gains popularity. > So, for example, if you were trying to download every file posted to > a group, and give than all unique names, you could use a hash to do that. > The size of the hash needed for that problem is related to the birthday > paradox. If any file collides with any other file, you have a problem. Same problem if someone is trying to build an index of files posted to the group, which this hash could be used for. > But when trying to find missing segments of files which a given user has > partially downloaded, we only worry about a hash collision between one > of the files he is looking for, and everything else posted to the group > over some extended period of time, like a year. The size hash you need > for this problem will be smaller than the size you need for the > birthday paradox. It will be a function of the "typical" number of partial > files the user will be seraching for. If that number were as high as 100, > and the number of articles posted to the group in a year is Y, then the > number of potential collisions is on the order of 100*Y for this > problem instead of y^2 like it is for the birthday paradox. Sure, it's highly unlikely a specific user will have problems. But every file will be downloaded by some user, thus be compared against all the rest. Or are you arguing something different? > In other words, a shorter hash may mean that about N files posted to the > group in a year will be expected to collide with N other files posted to > the same group, but the odds of a given user downloading one of those files > and trying to locate missing segments for it will be much smaller simply > because most users don't download most files. If a typical user downloads > 1 out of 100 files from the group, then the odds of him having a problem is > more like N/100 (that's probably wrong), but it will be much less than N. Same objection. > Plus, if a file is posted, and a week later, segments are re-posted and the > user finds everything he needs, the fact that a different file posted 2 > months later has the same short hash is not going to cause him a problem. > So there are mulitple effects at work reducing the odds of a hash collision > in the group causing a problem for the user. True. Other facts, such as the notion that it is unlikely that anyone will wait a whole year to complete a file, are odds-reducers. > So even though the birthday paradox is related to the odds of a hash > collision happening in the group, the probability of a user having a > problem because of one of those hash collision is much smaller. So the > number of bits we need to reduce the user's problem to an acceptable level > is going to be smaller than the number of bits needed to solve all hash > collisions in the group (the birthday paradox). Let me try to reason this a bit. There are N files posted to the group in a year, M of which collide. Hopefully, M/N will be quite small. The average user has a 100/N * M/N chance of encountering a collision (I grant that it's really something like 1 - (1-m/n)^(100/n), but the other version is close enough). Assuming there are at least N/100 users (every file gets downloaded), there is still a n/100 * 100/n*m/n = m/n chance of _someone_ experiencing a collision. Sure, the chance for the average user is 1/100th of the birthday paradox chance for the group, but it is still likely that _someone_ will experience a collision. > I suspect that while the birthday problem may need 2x the number of bits > expected, this problem may simply need something closer to 1x. 1x I'm > thinking is what you need if the user only downloads one file and searchs > an entire year for missing parts, and if he searches for 100 files at once > on the average every day, then the you may need to add log2(100) more bits > to keep the probability of a problem the same? Something like that. However, the number of bits you need you add to keep the probability the same in the birthday paradox is a function of ln(x) too, so both angles are equivalent in that sense. I wonder, though, if this discussion is necessary, especially if you are only looking for group-unique hashes. 6 characters of base64 gives a 36-bit hash, which is adequate for usenet-global uniqueness when coupled with file size (assuming there aren't more than 80000 articles posted to usenet in a year with the same size). 7 characters of base64 is sufficient to uniquely identify between 600000 articles with a collision probability of <5%. If all that is needed is a group-unique hash, 6 characters is plenty. -MIke
Technical Details
Message-ID:
<a7gjur$lfk11$1@ID-26705.news.dfncis.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!fu-berlin.de!uni-berlin.de!shw50-97.accesscable.NET!not-for-mailReferences:
<180320022351466617%planb@newsreaders.com> <20020320140409.897$WW_-_@newsreader.com> <200320021558402413%planb@newsreaders.com> <20020320174111.780$V8@newsreader.com> <200320022314345462%planb@newsreaders.com> <20020321022856.582$dC@newsreader.com> <210320021224366481%planb@newsreaders.com> <20020321125143.414$Wp@newsreader.com> <a7ddkd$j6s1m$1@ID-26705.news.dfncis.de> <3c9c54a2.1953960@news> <a7e4h9$kvunt$1@ID-26705.news.dfncis.de> <20020322023326.175$pl@newsreader.com> <b8pl9u0lphocim3v2kj5r4ehaqpe27hhrs@4ax.com> <slrna9mefd.2hsu.andrew+nonews@trinity.supernews.net> <20020322184519.366$du@newsreader.com>Show Full Headers
Complete Article Headers
Message-ID: <a7gjur$lfk11$1@ID-26705.news.dfncis.de> Subject: Re: Using Message-ID to store binary file information Date: Fri, 22 Mar 2002 20:58:34 -0400 From: "Klaas" <spamhole@klaas.ca> References: <180320022351466617%planb@newsreaders.com> <20020320140409.897$WW_-_@newsreader.com> <200320021558402413%planb@newsreaders.com> <20020320174111.780$V8@newsreader.com> <200320022314345462%planb@newsreaders.com> <20020321022856.582$dC@newsreader.com> <210320021224366481%planb@newsreaders.com> <20020321125143.414$Wp@newsreader.com> <a7ddkd$j6s1m$1@ID-26705.news.dfncis.de> <3c9c54a2.1953960@news> <a7e4h9$kvunt$1@ID-26705.news.dfncis.de> <20020322023326.175$pl@newsreader.com> <b8pl9u0lphocim3v2kj5r4ehaqpe27hhrs@4ax.com> <slrna9mefd.2hsu.andrew+nonews@trinity.supernews.net> <20020322184519.366$du@newsreader.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!fu-berlin.de!uni-berlin.de!shw50-97.accesscable.NET!not-for-mail Newsgroups: alt.usenet.offline-reader.forte-agent,news.software.nntp Organization: This is a valid mailbox Lines: 151 NNTP-Posting-Host: shw50-97.accesscable.net (24.138.50.97) X-Trace: fu-berlin.de 1016845084 22532129 24.138.50.97 (16 [26705]) X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200