Esempio n. 1
0
void MD4Encode(unsigned char *output, const unsigned char *input, unsigned int len){
    
#ifdef USE_COMMON_CRYPTO
    CC_MD4_CTX context = {};
    
    CC_MD4_Init (&context);
    CC_MD4_Update (&context, (unsigned char *)input, len);
    CC_MD4_Final (output, &context);

#else
    MD4_CTX context = {};
    
    MD4_Init (&context);
    MD4_Update (&context, (unsigned char *)input, len);
    MD4_Final (output, &context);
    
    /*
    mbedtls_md4_context ctx;
    
    mbedtls_md4_init( &ctx );
    mbedtls_md4_starts( &ctx );
    mbedtls_md4_update( &ctx, (unsigned char *)input, len );
    mbedtls_md4_finish( &ctx, output );
    mbedtls_md4_free( &ctx );
    */
#endif
    
}
Esempio n. 2
0
void ocspdMD4(
	const void		*data,
	CC_LONG			len,
	unsigned char	*md)		// allocd by caller, CC_MD4_DIGEST_LENGTH bytes
{
	CC_MD4_CTX ctx;
	CC_MD4_Init(&ctx);
	CC_MD4_Update(&ctx, data, len);
	CC_MD4_Final(md, &ctx);
}
MD4Digest::MD4Digest() : Digest(kSecDigestMD4, CC_MD4_DIGEST_LENGTH)
{
	CC_MD4_Init(&mContext);
}