MCPcopy Create free account
hub / github.com/amule-project/amule / MD5Update

Function MD5Update

src/utils/mkFileSum.c:196–224  ·  view source on GitHub ↗

MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */

Source from the content-addressed store, hash-verified

194 context.
195 */
196void MD5Update (MD5_CTX *context, const unsigned char *input, unsigned int inputLen)
197{
198 unsigned int i, index, partLen;
199
200 /* Compute number of bytes mod 64 */
201 index = (unsigned int)((context->count[0] >> 3) & 0x3F);
202
203 /* Update number of bits */
204 if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) {
205 context->count[1]++;
206 }
207 context->count[1] += ((UINT4)inputLen >> 29);
208 partLen = 64 - index;
209
210 /* Transform as many times as possible. */
211 if (inputLen >= partLen) {
212 MD5_memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
213 MD5Transform (context->state, context->buffer);
214
215 for (i = partLen; i + 63 < inputLen; i += 64) {
216 MD5Transform (context->state, &input[i]);
217 }
218 index = 0;
219 } else {
220 i = 0;
221 }
222 /* Buffer remaining input */
223 MD5_memcpy((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i);
224}
225
226/* MD5 finalization. Ends an MD5 message-digest operation, writing the
227 * the message digest and zeroizing the context.

Callers 2

mainFunction · 0.70
MD5FinalFunction · 0.70

Calls 2

MD5_memcpyFunction · 0.85
MD5TransformFunction · 0.70

Tested by

no test coverage detected