GTToolBox/GTEncryption/GTEncryptionMDFive.c
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
 the message digest and zeroizing the context.
 */
MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
MD5 finalization . Ends an MD5 message - digest operation writing the the message digest and zeroizing the context .
static void ZX_MD5Final(unsigned char digest[16],MD5_CTX *context)
{
    unsigned char bits[8];
    unsigned int index, padLen;
    static unsigned char PADDING[64] = {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };
    ZX_Encode (bits, context->count, 8);
    index = (unsigned int)((context->count[0] >> 3) & 0x3f);
    padLen = (index < 56) ? (56 - index) : (120 - index);
    ZX_MD5Update (context, PADDING, padLen);
    ZX_MD5Update (context, bits, 8);
    ZX_Encode (digest, context->state, 16);
    ZX_MD5_memset ((POINTER)context, 0, sizeof (*context));
}
static void ZX_MD5Final ( unsigned char digest [ 16 ] , MD5_CTX * context ) { unsigned char bits [ 8 ] ; unsigned int index , padLen ; static unsigned char PADDING [ 64 ] = { 0x80 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; ZX_Encode ( bits , context -> count , 8 ) ; index = ( unsigned int ) ( ( context -> count [ 0 ] >> 3 ) & 0x3f ) ; padLen = ( index < 56 ) ? ( 56 - index ) : ( 120 - index ) ; ZX_MD5Update ( context , PADDING , padLen ) ; ZX_MD5Update ( context , bits , 8 ) ; ZX_Encode ( digest , context -> state , 16 ) ; ZX_MD5_memset ( ( POINTER ) context , 0 , sizeof ( * context ) ) ; }
MD5 finalization.
MD5 finalization .
/* Save number of bits */ /* Pad out to 56 mod 64.*/ /* Append length (before padding) */ /* Store state in digest */ /* Zeroize sensitive information.*/