summaryrefslogtreecommitdiff
path: root/hash.h
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2021-08-30 14:57:37 +0000
committerJunio C Hamano <gitster@pobox.com>2021-09-07 10:47:43 -0700
commit27f3796ac1f9b711fae506f63186034ed178690c (patch)
treed82c23124c2df0f3fa49b3c781f33a065a9d7dc7 /hash.h
parentc4203212e360b25a1c69467b5a8437d45a373cac (diff)
downloadgit-27f3796ac1f9b711fae506f63186034ed178690c.tar.gz
hash.h: provide constants for the hash IDs
This will simplify referencing them from code that is not deeply integrated with Git, in particular, the reftable library. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/hash.h b/hash.h
index 9e25c40e9a..5d40368f18 100644
--- a/hash.h
+++ b/hash.h
@@ -95,12 +95,18 @@ static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *s
/* Number of algorithms supported (including unknown). */
#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)
+/* "sha1", big-endian */
+#define GIT_SHA1_FORMAT_ID 0x73686131
+
/* The length in bytes and in hex digits of an object name (SHA-1 value). */
#define GIT_SHA1_RAWSZ 20
#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)
/* The block size of SHA-1. */
#define GIT_SHA1_BLKSZ 64
+/* "s256", big-endian */
+#define GIT_SHA256_FORMAT_ID 0x73323536
+
/* The length in bytes and in hex digits of an object name (SHA-256 value). */
#define GIT_SHA256_RAWSZ 32
#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)