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

Re: [PATCH] describe: use khash in finish_depth_computation()

From
Jeff King <peff@peff.net>
Date
Sep 4, 2025, 11:16 UTC
Message-ID
<20250904111619.GA2474144@coredump.intra.peff.net>
In-Reply-To
<f6b4c1fb-9f59-4072-a796-e2971524ffa5@web.de>
On Wed, Sep 03, 2025 at 05:41:49PM +0200, René Scharfe wrote:
Show 6 quoted lines
> How does an attacker control object hashes?  Hash it, check if it fits
> the criteria, if it doesn't then make some inconsequential changes like
> adding whitespace to a commit message and repeat.  That criteria can be
> "bits 1-16 are all zero", but it can just as well be "bits 1-8 XORed
> with bits 9-16 are all zero".  For the former they'd have to roll the
> dice in the order of 2^16 times, for the latter just 2^8 times.

Hmm, yeah, you're right. I was counting the wrong thing. It is not one expensive action to generate a byte (or word) of sha1 hash. It is one action to generate the whole hash. And then cheap to XOR it and find out what the result would be in our XOR-bucket scheme. So if you are just brute-forcing anyway, it is the same number of hash attempts, which is what the attacker cares about minimizing. My proposal adds nothing there.

Show 5 quoted lines
> The attacker in our scenario doesn't have to care about the individual
> bits of object hashes, just the resulting hash table hashes, which
> reduces their search space a lot.  Making the deterministic function
> more complicated or using more attacker-supplied input bits doesn't
> change that.
Yep. Thanks for a dose of sanity.
-Peff
Previous: René ScharfeNext: René Scharfe
Message 17 of 21 in “describe: use khash in finish_depth_computation()”
  1. describe: use khash in finish_depth_computation()René Scharfe, Aug 24, 2025
  2. Jeff KingAug 24, 2025
  3. René ScharfeAug 24, 2025
  4. Jeff KingAug 25, 2025
  5. Jeff KingAug 25, 2025
  6. Junio C HamanoAug 25, 2025
  7. Jeff KingAug 26, 2025
  8. Jeff KingAug 26, 2025
  9. Jeff KingAug 26, 2025
  10. Junio C HamanoAug 26, 2025
  11. René ScharfeAug 31, 2025
  12. René ScharfeSep 1, 2025
  13. Jeff KingSep 2, 2025
  14. René ScharfeSep 2, 2025
  15. Jeff KingSep 3, 2025
  16. René ScharfeSep 3, 2025
  17. Jeff KingSep 4, 2025
  18. René ScharfeSep 3, 2025
  19. Jeff KingSep 4, 2025
  20. describe: use oidset in finish_depth_computation()René Scharfe, Sep 2, 2025
  21. Jeff KingSep 3, 2025

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.