X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=hash.h;h=52a4f1a3f43089f02bbdcfb2759da479841c7405;hb=86ad3ea5cff8fa09180408e610b269390c1f4848;hp=661c9f228128c2036fa4c5c238f2e35f9a42f13b;hpb=7011ce12b895d172562dcaa7d8b240f3594dc981;p=thirdparty%2Fgit.git diff --git a/hash.h b/hash.h index 661c9f2281..52a4f1a3f4 100644 --- a/hash.h +++ b/hash.h @@ -139,4 +139,28 @@ static inline int hash_algo_by_ptr(const struct git_hash_algo *p) return p - hash_algos; } +/* 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 + +/* 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) +/* The block size of SHA-256. */ +#define GIT_SHA256_BLKSZ 64 + +/* The length in byte and in hex digits of the largest possible hash value. */ +#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ +#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ +/* The largest possible block size for any supported hash. */ +#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ + +struct object_id { + unsigned char hash[GIT_MAX_RAWSZ]; +}; + +#define the_hash_algo the_repository->hash_algo + #endif