]> git.proxmox.com Git - libgit2.git/blob - src/hash.h
Merge pull request #1209 from ethomson/update_copyright
[libgit2.git] / src / hash.h
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_hash_h__
8 #define INCLUDE_hash_h__
9
10 #include "git2/oid.h"
11
12 typedef struct git_hash_prov git_hash_prov;
13 typedef struct git_hash_ctx git_hash_ctx;
14
15 int git_hash_global_init(void);
16 void git_hash_global_shutdown(void);
17
18 int git_hash_ctx_init(git_hash_ctx *ctx);
19 void git_hash_ctx_cleanup(git_hash_ctx *ctx);
20
21 #if defined(OPENSSL_SHA1)
22 # include "hash/hash_openssl.h"
23 #elif defined(WIN32_SHA1)
24 # include "hash/hash_win32.h"
25 #else
26 # include "hash/hash_generic.h"
27 #endif
28
29 typedef struct {
30 void *data;
31 size_t len;
32 } git_buf_vec;
33
34 int git_hash_init(git_hash_ctx *c);
35 int git_hash_update(git_hash_ctx *c, const void *data, size_t len);
36 int git_hash_final(git_oid *out, git_hash_ctx *c);
37
38 int git_hash_buf(git_oid *out, const void *data, size_t len);
39 int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n);
40
41 #endif /* INCLUDE_hash_h__ */