MCPcopy Create free account
hub / github.com/ddnet/ddnet / sha_process

Function sha_process

src/base/hash_libtomcrypt.cpp:126–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static void sha_process(sha256_state *md, const void *src, u32 inlen)
127{
128 const u32 block_size = 64;
129 const unsigned char *in = (const unsigned char *)src;
130
131 while(inlen > 0)
132 {
133 if(md->curlen == 0 && inlen >= block_size)
134 {
135 sha_compress(md, in);
136 md->length += block_size * 8;
137 in += block_size;
138 inlen -= block_size;
139 }
140 else
141 {
142 u32 n = minimum(inlen, (block_size - md->curlen));
143 memcpy(md->buf + md->curlen, in, n);
144 md->curlen += n;
145 in += n;
146 inlen -= n;
147
148 if(md->curlen == block_size)
149 {
150 sha_compress(md, md->buf);
151 md->length += 8 * block_size;
152 md->curlen = 0;
153 }
154 }
155 }
156}
157
158static void sha_done(sha256_state *md, void *out)
159{

Callers 1

sha256_updateFunction · 0.85

Calls 2

sha_compressFunction · 0.85
minimumFunction · 0.70

Tested by

no test coverage detected