Merge branch 'ab/streaming-simplify'
[alt-git.git] / compat / sha1-chunked.c
blob6adfcfd54051617fd4cbdd0e5d8a904c2a839152
1 #include "cache.h"
3 int git_SHA1_Update_Chunked(platform_SHA_CTX *c, const void *data, size_t len)
5 size_t nr;
6 size_t total = 0;
7 const char *cdata = (const char*)data;
9 while (len) {
10 nr = len;
11 if (nr > SHA1_MAX_BLOCK_SIZE)
12 nr = SHA1_MAX_BLOCK_SIZE;
13 platform_SHA1_Update(c, cdata, nr);
14 total += nr;
15 cdata += nr;
16 len -= nr;
18 return total;