#ifndef HASH_H
#define HASH_H
#if defined(SHA1_APPLE)
#include <CommonCrypto/CommonDigest.h>
#elif defined(SHA1_OPENSSL)
# include <openssl/sha.h>
# if defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL >= 3
#define SHA1_NEEDS_CLONE_HELPER
# include "sha1/openssl.h"
# endif
#elif defined(SHA1_DC)
#include "sha1dc_git.h"
#else
#include "block-sha1/sha1.h"
#endif
#if defined(SHA1_APPLE_UNSAFE)
# include <CommonCrypto/CommonDigest.h>
#define platform_SHA_CTX_unsafe …
#define platform_SHA1_Init_unsafe …
#define platform_SHA1_Update_unsafe …
#define platform_SHA1_Final_unsafe …
#elif defined(SHA1_OPENSSL_UNSAFE)
# include <openssl/sha.h>
# if defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL >= 3
#define SHA1_NEEDS_CLONE_HELPER_UNSAFE
# include "sha1/openssl.h"
#define platform_SHA_CTX_unsafe …
#define platform_SHA1_Init_unsafe …
#define platform_SHA1_Clone_unsafe …
#define platform_SHA1_Update_unsafe …
#define platform_SHA1_Final_unsafe …
# else
#define platform_SHA_CTX_unsafe …
#define platform_SHA1_Init_unsafe …
#define platform_SHA1_Update_unsafe …
#define platform_SHA1_Final_unsafe …
# endif
#elif defined(SHA1_BLK_UNSAFE)
# include "block-sha1/sha1.h"
#define platform_SHA_CTX_unsafe …
#define platform_SHA1_Init_unsafe …
#define platform_SHA1_Update_unsafe …
#define platform_SHA1_Final_unsafe …
#endif
#if defined(SHA256_NETTLE)
#include "sha256/nettle.h"
#elif defined(SHA256_GCRYPT)
#define SHA256_NEEDS_CLONE_HELPER
#include "sha256/gcrypt.h"
#elif defined(SHA256_OPENSSL)
# include <openssl/sha.h>
# if defined(OPENSSL_API_LEVEL) && OPENSSL_API_LEVEL >= 3
#define SHA256_NEEDS_CLONE_HELPER
# include "sha256/openssl.h"
# endif
#else
#include "sha256/block/sha256.h"
#endif
#ifndef platform_SHA_CTX
#define platform_SHA_CTX …
#define platform_SHA1_Init …
#define platform_SHA1_Update …
#define platform_SHA1_Final …
#endif
#ifndef platform_SHA_CTX_unsafe
#define platform_SHA_CTX_unsafe …
#define platform_SHA1_Init_unsafe …
#define platform_SHA1_Update_unsafe …
#define platform_SHA1_Final_unsafe …
# ifdef platform_SHA1_Clone
#define platform_SHA1_Clone_unsafe …
# endif
# ifdef SHA1_NEEDS_CLONE_HELPER
#define SHA1_NEEDS_CLONE_HELPER_UNSAFE
# endif
#endif
#define git_SHA_CTX …
#define git_SHA1_Init …
#define git_SHA1_Update …
#define git_SHA1_Final …
#define git_SHA_CTX_unsafe …
#define git_SHA1_Init_unsafe …
#define git_SHA1_Update_unsafe …
#define git_SHA1_Final_unsafe …
#ifdef platform_SHA1_Clone
#define git_SHA1_Clone …
#endif
#ifdef platform_SHA1_Clone_unsafe
#define git_SHA1_Clone_unsafe …
#endif
#ifndef platform_SHA256_CTX
#define platform_SHA256_CTX …
#define platform_SHA256_Init …
#define platform_SHA256_Update …
#define platform_SHA256_Final …
#endif
#define git_SHA256_CTX …
#define git_SHA256_Init …
#define git_SHA256_Update …
#define git_SHA256_Final …
#ifdef platform_SHA256_Clone
#define git_SHA256_Clone …
#endif
#ifdef SHA1_MAX_BLOCK_SIZE
#include "compat/sha1-chunked.h"
#undef git_SHA1_Update
#define git_SHA1_Update …
#endif
#ifndef SHA1_NEEDS_CLONE_HELPER
static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)
{ … }
#endif
#ifndef SHA1_NEEDS_CLONE_HELPER_UNSAFE
static inline void git_SHA1_Clone_unsafe(git_SHA_CTX_unsafe *dst,
const git_SHA_CTX_unsafe *src)
{ … }
#endif
#ifndef SHA256_NEEDS_CLONE_HELPER
static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)
{ … }
#endif
#define GIT_HASH_UNKNOWN …
#define GIT_HASH_SHA1 …
#define GIT_HASH_SHA256 …
#define GIT_HASH_NALGOS …
#define GIT_SHA1_FORMAT_ID …
#define GIT_SHA1_RAWSZ …
#define GIT_SHA1_HEXSZ …
#define GIT_SHA1_BLKSZ …
#define GIT_SHA256_FORMAT_ID …
#define GIT_SHA256_RAWSZ …
#define GIT_SHA256_HEXSZ …
#define GIT_SHA256_BLKSZ …
#define GIT_MAX_RAWSZ …
#define GIT_MAX_HEXSZ …
#define GIT_MAX_BLKSZ …
struct object_id { … };
#define GET_OID_QUIETLY …
#define GET_OID_COMMIT …
#define GET_OID_COMMITTISH …
#define GET_OID_TREE …
#define GET_OID_TREEISH …
#define GET_OID_BLOB …
#define GET_OID_FOLLOW_SYMLINKS …
#define GET_OID_RECORD_PATH …
#define GET_OID_ONLY_TO_DIE …
#define GET_OID_REQUIRE_PATH …
#define GET_OID_HASH_ANY …
#define GET_OID_DISAMBIGUATORS …
enum get_oid_result { … };
#ifdef USE_THE_REPOSITORY_VARIABLE
# include "repository.h"
#define the_hash_algo …
#endif
git_hash_ctx;
git_hash_ctx;
git_hash_init_fn;
git_hash_clone_fn;
git_hash_update_fn;
git_hash_final_fn;
git_hash_final_oid_fn;
struct git_hash_algo { … };
extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];
int hash_algo_by_name(const char *name);
int hash_algo_by_id(uint32_t format_id);
int hash_algo_by_length(int len);
static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
{ … }
const struct object_id *null_oid(void);
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
{ … }
static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
{ … }
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src,
const struct git_hash_algo *algop)
{ … }
static inline void hashclr(unsigned char *hash, const struct git_hash_algo *algop)
{ … }
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
{ … }
static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)
{ … }
static inline void oidcpy(struct object_id *dst, const struct object_id *src)
{ … }
static inline void oidread(struct object_id *oid, const unsigned char *hash,
const struct git_hash_algo *algop)
{ … }
static inline void oidclr(struct object_id *oid,
const struct git_hash_algo *algop)
{ … }
static inline struct object_id *oiddup(const struct object_id *src)
{ … }
static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)
{ … }
static inline unsigned int oidhash(const struct object_id *oid)
{ … }
static inline int is_null_oid(const struct object_id *oid)
{ … }
const char *empty_tree_oid_hex(const struct git_hash_algo *algop);
static inline int is_empty_blob_oid(const struct object_id *oid,
const struct git_hash_algo *algop)
{ … }
static inline int is_empty_tree_oid(const struct object_id *oid,
const struct git_hash_algo *algop)
{ … }
#endif