diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-30 08:11:40 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-10-02 16:34:47 -0400 |
| commit | 31ecaca2d3e87d20782a54cb319f5c19e6c6e62f (patch) | |
| tree | 06131413f2e42a8c3e51bbe0134f9267531bad62 /src/hash.h | |
| parent | 2a713da1ec2e9f74c9edc75b06540ab095c68c34 (diff) | |
| download | libgit2-31ecaca2d3e87d20782a54cb319f5c19e6c6e62f.tar.gz | |
hash: hash functions operate on byte arrays not git_oids
Separate the concerns of the hash functions from the git_oid functions.
The git_oid structure will need to understand either SHA1 or SHA256; the
hash functions should only deal with the appropriate one of these.
Diffstat (limited to 'src/hash.h')
| -rw-r--r-- | src/hash.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/hash.h b/src/hash.h index 7938e3b22..ec91fa43a 100644 --- a/src/hash.h +++ b/src/hash.h @@ -11,6 +11,7 @@ #include "common.h" #include "git2/oid.h" +#include "hash/sha1.h" typedef struct { void *data; @@ -22,8 +23,6 @@ typedef enum { GIT_HASH_ALGORITHM_SHA1 } git_hash_algorithm_t; -#include "hash/sha1.h" - typedef struct git_hash_ctx { union { git_hash_sha1_ctx sha1; @@ -38,9 +37,9 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx); int git_hash_init(git_hash_ctx *c); int git_hash_update(git_hash_ctx *c, const void *data, size_t len); -int git_hash_final(git_oid *out, git_hash_ctx *c); +int git_hash_final(unsigned char *out, git_hash_ctx *c); -int git_hash_buf(git_oid *out, const void *data, size_t len, git_hash_algorithm_t algorithm); -int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n, git_hash_algorithm_t algorithm); +int git_hash_buf(unsigned char *out, const void *data, size_t len, git_hash_algorithm_t algorithm); +int git_hash_vec(unsigned char *out, git_buf_vec *vec, size_t n, git_hash_algorithm_t algorithm); #endif |
