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

[PATCH 3/5] sha1dc: disable safe_hash feature

From
Jeff King <peff@peff.net>
Date
Mar 16, 2017, 22:08 UTC
Message-ID
<20170316220849.ye56ycpoly2o5fg6@sigill.intra.peff.net>
In-Reply-To
<20170316220456.m4yz2kbvzv6waokn@sigill.intra.peff.net>

The safe_hash feature is designed to make sha1dc a drop-in replacement for sha1, where colliding entries will get a permuted hash to un-collide them. However, since we're handling the collision case ourselves, this isn't helpful (and is actually harmful, as it means you get the wrong object id if you want to show it in a log message).

Signed-off-by: Jeff King <peff@peff.net>
---
We could also disable this at runtime, but there's not really any point.
And this way we know that we won't miss a call.
 sha1dc/sha1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index da516c14c..00760c352 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -1661,7 +1661,7 @@ void SHA1DCInit(SHA1_CTX* ctx)
 	ctx->ihv[3] = 0x10325476;
 	ctx->ihv[4] = 0xC3D2E1F0;
 	ctx->found_collision = 0;
-	ctx->safe_hash = 1;
+	ctx->safe_hash = 0;
 	ctx->ubc_check = 1;
 	ctx->detect_coll = 1;
 	ctx->reduced_round_coll = 0;
-- 
2.12.0.623.g86ec6c963
Previous: Jeff KingNext: Jeff King
Message 4 of 20 in “Re-integrate sha1dc”
  1. 0/2 Re-integrate sha1dcLinus Torvalds, Mar 16, 2017
  2. Jeff KingMar 16, 2017
  3. 2/5 sha1dc: adjust header includes for gitJeff King, Mar 16, 2017
  4. 3/5 sha1dc: disable safe_hash featureJeff King, Mar 16, 2017
  5. 4/5 Makefile: add USE_SHA1DC knobJeff King, Mar 16, 2017
  6. Junio C HamanoMar 16, 2017
  7. Jeff KingMar 17, 2017
  8. Junio C HamanoMar 17, 2017
  9. Jeff KingMar 17, 2017
  10. 0/3 Git integration update for DC-SHA1Junio C Hamano, Mar 17, 2017
  11. 1/3 Makefile: add DC_SHA1 knobJunio C Hamano, Mar 17, 2017
  12. 3/3 Makefile: make DC_SHA1 the defaultJunio C Hamano, Mar 17, 2017
  13. Junio C HamanoMar 17, 2017
  14. Jeff KingMar 17, 2017
  15. Jeff KingMar 16, 2017
  16. Junio C HamanoMar 16, 2017
  17. Jeff KingMar 17, 2017
  18. Junio C HamanoMar 17, 2017
  19. Jeff KingMar 17, 2017
  20. Linus TorvaldsMar 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.