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

Re: git behaviour question regarding SHA-1 and commits

From
Jeff King <peff@peff.net>
Date
Nov 14, 2011, 13:04 UTC
Message-ID
<20111114130407.GA24156@sigill.intra.peff.net>
In-Reply-To
<20111114124851.GB21854@victor>
On Mon, Nov 14, 2011 at 01:48:51PM +0100, Victor Engmark wrote:
Show 11 quoted lines
> > Fortunately we have such a thing:
> > 
> >   http://article.gmane.org/gmane.comp.version-control.git/184243
> > 
> > That one actually has 40 bits of hash entropy, so you'd expect to
> > generate 2^20 (about a million) commits before accidentally colliding.
> > If you want an easier experiment, you could truncate it even further.
> 
> Would it be helpful to truncate this to something ludicrous like a
> single byte of entropy, to be able to write tests for the various tools
> and options?

That's probably too small. Obviously any implementation like this is not going to be usable for interacting with existing repositories, but if you have too many collisions, then you won't even be able to create a few new commits for your test.

Something like 20 bits means you can brute-force a collision for a particular blob, commit, tree, or whatever in a few seconds, but you won't be having accidental ones all the time.

-Peff
Previous: Victor EngmarkNext: Dmitry Potapov
Message 9 of 11 in “git behaviour question regarding SHA-1 and commits”
  1. vinassa vinassaNov 13, 2011
  2. Ævar Arnfjörð BjarmasonNov 13, 2011
  3. Junio C HamanoNov 14, 2011
  4. Jeff KingNov 14, 2011
  5. Jonathan NiederNov 13, 2011
  6. vinassa vinassaNov 13, 2011
  7. Jeff KingNov 14, 2011
  8. Victor EngmarkNov 14, 2011
  9. Jeff KingNov 14, 2011
  10. Dmitry PotapovNov 13, 2011
  11. Johannes SixtNov 14, 2011

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.