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

Re: Why SHA are 40 bytes? (aka looking for flames)

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Apr 21, 2007, 18:28 UTC
Message-ID
<e5bfff550704211128i12035947i7597e920a0eca163@mail.gmail.com>
In-Reply-To
<9e4733910704211059h16c06e11k967d0bdd3e4970fc@mail.gmail.com>
On 4/21/07, Jon Smirl <jonsmirl@gmail.com> wrote:
>
> You have to store the full SHAs at least once since they are the
> signature against data corruption.
>
This is interesting.
So until know I learnt 3 uses of sha:
- Reference an object
- Check against object data corruption
- Prevent any possible collision among objects
Karl says that we need 160 bits to prevent collisions:
Show 5 quoted lines
>prevent any possible collision created by a malicious adversary, too,
>so that it's possible to e.g. sign just a commit and be able to trust
>everything it points to. The SHA1 designers felt that 160 bits was a
>good compromise between size and robustness, and we just trust that
>their (and the cryptographic community's) guess is good enough.

Probably we don't need 160bits to reference an object. I really don't know how many bit we need to be robust against data corruption.

Someone more versed then me in SHA1 could tell the probablity to find a corrupted object calculating his hash and checking against his stored 160bits known good signature and *FAIL* to find as corrupt *the same object* calculating his hash and checking against a truncated sha to say 20bits.

I would say this probability is veery veery low in random case (not a malicious attack of course, but I think this is not the case with git repository as it was with SHA1 designers).

Marco
Previous: Jon SmirlNext: Jon Smirl
Message 9 of 18 in “Why SHA are 40 bytes? (aka looking for flames)”
  1. Marco CostalbaApr 21, 2007
  2. Andy ParkinsApr 21, 2007
  3. Karl HasselströmApr 21, 2007
  4. Marco CostalbaApr 21, 2007
  5. Marco CostalbaApr 21, 2007
  6. Jon SmirlApr 21, 2007
  7. Marco CostalbaApr 21, 2007
  8. Jon SmirlApr 21, 2007
  9. Marco CostalbaApr 21, 2007
  10. Jon SmirlApr 21, 2007
  11. Andreas EricssonApr 24, 2007
  12. Nicolas PitreApr 24, 2007
  13. Andreas EricssonApr 24, 2007
  14. Nicolas PitreApr 24, 2007
  15. Nicolas PitreApr 22, 2007
  16. H. Peter AnvinApr 24, 2007
  17. Shawn O. PearceApr 24, 2007
  18. Nicolas PitreApr 24, 2007

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.