# MATH_CalcHMACSHA1

## Syntax

      #include <nitro/math/dgt.h>

      static inline void MATH_CalcHMACSHA1( 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 SHA-1. The length of the generated keyed-hash value is 160 bits, or `MATH_SHA1_DIGEST_SIZE (= 20)` 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_SHA1_DIGEST_SIZE`, it becomes weaker. Even if the key is larger than `MATH_SHA1_DIGEST_SIZE`, little additional strength is gained. Internally, the stack size will be the size of the `MATHSHA1Context` structure plus about `100` (one-hundred) bytes. Make sure sufficient stack is available when calling. SHA-1 is an algorithm to find the message digest value. For details, see RFC (Request For Comments) 3174, which is published by IETF (The Internet Engineering Task Force). HMAC is a keyed-hashing algorithm for message authentication. The algorithm that uses SHA-1 internally as a hash function is called `HMAC-SHA-1`. For details, see RFC 2104.

## See Also

``

## Revision History

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

CONFIDENTIAL