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

Function MD5Final

src/dolphin/src/eth/md5.c:146–169  ·  view source on GitHub ↗

MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */

Source from the content-addressed store, hash-verified

144 the message digest and zeroizing the context.
145 */
146void MD5Final(u8 digest[16], MD5_CTX *context)
147/* digest: message digest */
148/* context: context */
149{
150 u8 bits[8];
151 u32 index, padLen;
152
153 /* Save number of bits */
154 Encode (bits, context->count, 8);
155
156 /* Pad out to 56 mod 64. */
157 index = (u32)((context->count[0] >> 3) & 0x3f);
158 padLen = (index < 56) ? (56 - index) : (120 - index);
159 MD5Update (context, PADDING, padLen);
160
161 /* Append length (before padding) */
162 MD5Update (context, bits, 8);
163
164 /* Store state in digest */
165 Encode (digest, context->state, 16);
166
167 /* Zeroize sensitive information. */
168 memset(context, 0, sizeof(*context));
169}
170
171/* MD5 basic transformation. Transforms state based on block.
172 */

Callers 1

CalcDigestFunction · 0.85

Calls 3

EncodeFunction · 0.85
MD5UpdateFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected