# MATH_CalcHMACMD5

## C Specification

      #include <nitro/math/dgt.h>

      static inline void MATH_CalcHMACMD5( void* digest, const void* data, u32 dataLength, const void* key, u32 keyLength );

## Arguments

digest | Pointer to the memory location that holds the calculated keyed-hash value.
data | Pointer to the input data
dataLength | Size of the input data
key | Pointer to the key.
keyLength | The key size.

## Return Values

None.

## Description

This function calculates an HMAC (hash message authentication code) using MD5. The length of the generated keyed-hash value is 128 bits, or `MATH_MD5_DIGEST_SIZE (= 16)` bytes. Use the "digest" argument to pass an area that can store a value of this size. Any size and alignment position can be used for the input data and key. However, if the key is smaller than `MATH_MD5_DIGEST_SIZE`, it becomes weaker. Even if the key is larger than `MATH_MD5_DIGEST_SIZE`, little additional strength is gained. Internally, the stack size will be the size of the `MATHMD5Context` structure plus about `100` (one-hundred) bytes. Make sure sufficient stack is available when calling. MD5 is an algorithm to find the message digest value. For details, see RFC (Request For Comments) 1321, which is published by IETF (The Internet Engineering Task Force). HMAC is a keyed-hashing algorithm for message authentication. The algorithm that uses MD5 internally as a hash function is called `HMAC-MD5`. For details, see RFC 2104.

## See Also

MATH_CalcHMACSHA1

## Revision History

04/12/2005 Corrected Description.
04/01/2005 Initial version.

CONFIDENTIAL