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

Re: [PATCH] Put sha1dc on a diet

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 1, 2017, 23:38 UTC
Message-ID
<CA+55aFz4ixVKVURki8FeXjL5H51A_cQXsZpzKJ-N9n574Yy1rg@mail.gmail.com>
In-Reply-To
<20170301203427.e5xa5ej3czli7c3o@sigill.intra.peff.net>
On Wed, Mar 1, 2017 at 12:34 PM, Jeff King <peff@peff.net> wrote:
>
> I don't think that helps. The sha1 over the pack-file takes about 1.3s
> with openssl, and 5s with sha1dc. So we already know the increase there
> is only a few seconds, not a few minutes.

Yeah, I did a few statistics by adding just logging of "SHA1_Init()" calls. For that network clone situation, the call distribution is

      1        SHA1: Init at builtin/index-pack.c:326
 841228        SHA1: Init at builtin/index-pack.c:450
      2        SHA1: Init at csum-file.c:152
4415756        SHA1: Init at sha1_file.c:3218

(the line numbers are a bit off from 'pu', because I obviously have the logging code).

The big number (one for every object) is from write_sha1_file_prepare(), which we'd want to be the strong collision checking version because those are things we're about to create git objects out of. It's called from

 - hash_sha1_file() - doesn't actually write the object, but is used
to calculate the sha for incoming data after applying the delta, for
example.
 - write_sha1_file() - many uses, actually writes the object
 - hash_sha1_file_literally() - git hash-object

and that index-pack.c:450 is from unpack_entry_data() for the base non-delta objects (which should also be the strong kind).

So all of them should check against collision attacks, so none of them seem to be things you'd want to optimize away..

So I was wrong in thinking that there were a lot of unnecessary SHA1 calculations in that load. They all look like they should be done with the slower checking code.

Oh well.
                      Linus
Previous: Jeff KingNext: Dan Shumow
Message 22 of 36 in “Put sha1dc on a diet”
  1. Put sha1dc on a dietLinus Torvalds, Mar 1, 2017
  2. Junio C HamanoMar 1, 2017
  3. Linus TorvaldsMar 1, 2017
  4. Jeff KingMar 1, 2017
  5. Junio C HamanoMar 1, 2017
  6. Johannes SchindelinMar 1, 2017
  7. Junio C HamanoMar 1, 2017
  8. Linus TorvaldsMar 1, 2017
  9. Johannes SchindelinMar 1, 2017
  10. Linus TorvaldsMar 1, 2017
  11. Jeff KingMar 1, 2017
  12. Duy NguyenMar 2, 2017
  13. Johannes SchindelinMar 2, 2017
  14. Linus TorvaldsMar 2, 2017
  15. Jeff HostetlerMar 2, 2017
  16. Linus TorvaldsMar 2, 2017
  17. Johannes SchindelinMar 2, 2017
  18. Johannes SchindelinMar 2, 2017
  19. Jeff KingMar 1, 2017
  20. Linus TorvaldsMar 1, 2017
  21. Jeff KingMar 1, 2017
  22. Linus TorvaldsMar 1, 2017
  23. Dan ShumowMar 2, 2017
  24. Junio C HamanoMar 2, 2017
  25. Dan ShumowMar 4, 2017
  26. Jeff KingMar 13, 2017
  27. Jeff KingMar 1, 2017
  28. Jeff KingMar 13, 2017
  29. Marc StevensMar 13, 2017
  30. Linus TorvaldsMar 13, 2017
  31. Marc StevensMar 13, 2017
  32. Jeff KingMar 13, 2017
  33. Marc StevensMar 13, 2017
  34. Marc StevensMar 16, 2017
  35. Jeff KingMar 16, 2017
  36. Dan ShumowMar 16, 2017

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.