git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Hash collision count

From
Petr Baudis <pasky@ucw.cz>
Date
Apr 23, 2005, 23:46 UTC
Message-ID
<20050423234637.GS13222@pasky.ji.cz>
In-Reply-To
<426AD835.5070404@pobox.com>

Dear diary, on Sun, Apr 24, 2005 at 01:20:21AM CEST, I got a letter where Jeff Garzik <jgarzik@pobox.com> told me that...

> Second, in your scenario, it's highly unlikely you would get 4 billion 
> sha1 hash collisions, even if you had the disk space to store such a git 
> database.
It's highly unlikely you would get a _single_ collision.
> First, the hash is NOT unique.
> 
> Second, you lose data if you pretend it is unique.  I don't like losing 
> data.
*sigh*
We've been through this before, haven't we?
> Third, a data check only occurs in the highly unlikely case that a hash 
> already exists -- a collision.  Rather than "trillions of times", more 
> like "one in a trillion chance."

No, a collision is pretty common thing, actually. It's the main power of git, actually - when you do read-tree, modify it and do write-tree (typically when doing commit), everything you didn't modify (99% of stuff, most likely) is basically a collision - but it's ok since it just stays the same.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Previous: Jeff GarzikNext: Jeff Garzik
Message 5 of 14 in “Hash collision count”
  1. Jeff GarzikApr 23, 2005
  2. Jeff GarzikApr 23, 2005
  3. Ray HeasmanApr 23, 2005
  4. Jeff GarzikApr 23, 2005
  5. Petr BaudisApr 23, 2005
  6. Jeff GarzikApr 24, 2005
  7. Petr BaudisApr 24, 2005
  8. Jeff GarzikApr 24, 2005
  9. Imre SimonApr 24, 2005
  10. Whales falling on houses - was: Hash collision countJon Seymour, Apr 24, 2005
  11. Tom LordApr 25, 2005
  12. Petr BaudisApr 26, 2005
  13. Ray HeasmanApr 24, 2005
  14. David LangApr 24, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.