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

[PATCH 2/2] Replace open-coded version of hash_sha1_file()

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Oct 15, 2006, 12:02 UTC
Message-ID
<4532234A.3090700@lsrfire.ath.cx>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 sha1_file.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 66cc767..716aef3 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -671,14 +671,8 @@ static void reprepare_packed_git(void)
 
 int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long size, const char *type)
 {
-	char header[100];
 	unsigned char real_sha1[20];
-	SHA_CTX c;
-
-	SHA1_Init(&c);
-	SHA1_Update(&c, header, 1+sprintf(header, "%s %lu", type, size));
-	SHA1_Update(&c, map, size);
-	SHA1_Final(real_sha1, &c);
+	hash_sha1_file(map, size, type, real_sha1);
 	return hashcmp(sha1, real_sha1) ? -1 : 0;
 }
 
-- 
1.4.3.rc2.gdce3
Message 1 of 1 in “Replace open-coded version of hash_sha1_file()”
  1. 2/2 Replace open-coded version of hash_sha1_file()Rene Scharfe, Oct 15, 2006

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.