]> git.proxmox.com Git - libgit2.git/blame - src/hash.h
Merge pull request #1363 from schu/hash-initialization
[libgit2.git] / src / hash.h
CommitLineData
007e0753 1/*
359fc2d2 2 * Copyright (C) the libgit2 contributors. All rights reserved.
bb742ede
VM
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.
007e0753
RJ
6 */
7#ifndef INCLUDE_hash_h__
8#define INCLUDE_hash_h__
9
44908fe7 10#include "git2/oid.h"
007e0753 11
d6fb0924 12typedef struct git_hash_prov git_hash_prov;
007e0753
RJ
13typedef struct git_hash_ctx git_hash_ctx;
14
7ebefd22 15int git_hash_global_init(void);
a8527429 16void git_hash_global_shutdown(void);
7ebefd22 17
603bee07
ET
18int git_hash_ctx_init(git_hash_ctx *ctx);
19void git_hash_ctx_cleanup(git_hash_ctx *ctx);
20
d6fb0924
ET
21#if defined(OPENSSL_SHA1)
22# include "hash/hash_openssl.h"
23#elif defined(WIN32_SHA1)
24# include "hash/hash_win32.h"
d6fb0924
ET
25#else
26# include "hash/hash_generic.h"
27#endif
28
007e0753
RJ
29typedef struct {
30 void *data;
31 size_t len;
32} git_buf_vec;
33
d6fb0924
ET
34int git_hash_update(git_hash_ctx *c, const void *data, size_t len);
35int git_hash_final(git_oid *out, git_hash_ctx *c);
007e0753 36
d6fb0924
ET
37int git_hash_buf(git_oid *out, const void *data, size_t len);
38int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n);
007e0753
RJ
39
40#endif /* INCLUDE_hash_h__ */