MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / MD5Update

Function MD5Update

src/dolphin/src/eth/md5.c:109–141  ·  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

107 context.
108 */
109void MD5Update(MD5_CTX *context, u8 *input, u32 inputLen)
110/* context: context */
111/* input: input block */
112/* inputlen: length of input block */
113{
114 u32 i, index, partLen;
115
116 /* Compute number of bytes mod 64 */
117 index = (u32)((context->count[0] >> 3) & 0x3F);
118
119 /* Update number of bits */
120 if ((context->count[0] += ((u32)inputLen << 3)) < ((u32)inputLen << 3))
121 context->count[1]++;
122 context->count[1] += ((u32)inputLen >> 29);
123 partLen = 64 - index;
124
125 /* Transform as many times as possible. */
126 if (inputLen >= partLen) {
127 memcpy(&context->buffer[index], input, partLen);
128 MD5Transform(context->state, context->buffer);
129
130 for (i = partLen; i + 63 < inputLen; i += 64) {
131 MD5Transform (context->state, &input[i]);
132 }
133
134 index = 0;
135 } else {
136 i = 0;
137 }
138
139 /* Buffer remaining input */
140 memcpy(&context->buffer[index], &input[i], inputLen - i);
141}
142
143/* MD5 finalization. Ends an MD5 message-digest operation, writing the
144 the message digest and zeroizing the context.

Callers 2

MD5FinalFunction · 0.85
CalcDigestFunction · 0.85

Calls 2

memcpyFunction · 0.85
MD5TransformFunction · 0.85

Tested by

no test coverage detected