1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>MATH_CalcHMACSHA1</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">MATH_CalcHMACSHA1 <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1>
15<H2>Syntax</H2>
16
17<dl>
18  <dd>
19  <PRE><CODE>#include &lt;nitro/math/dgt.h&gt;
20
21static inline void MATH_CalcHMACSHA1( void* digest, const void* data, u32 dataLength, const void* key, u32 keyLength );
22</CODE></PRE>
23  </dd>
24</dl><h2>Arguments</h2>
25
26<table border="1" width="100%">
27    <TR>
28<TD width="176"><em><strong><font face="Courier New">digest</font></strong></em></TD>
29<TD width="670">Pointer to the memory location that holds the calculated keyed-hash value.</TD>
30    </TR>
31    <TR>
32<TD width="176"><em><strong><font face="Courier New">data</font></strong></em></TD>
33<TD width="670">Pointer to the input data.</TD>
34    </TR>
35    <TR>
36<TD width="176"><em><strong><font face="Courier New">dataLength</font></strong></em></TD>
37<TD width="670">Size of the input data.</TD>
38    </TR>
39    <TR>
40<TD width="176"><em><strong><font face="Courier New">key</font></strong></em></TD>
41<TD width="670">Pointer to the key.</TD>
42    </TR>
43    <TR>
44<TD width="176"><em><strong><font face="Courier New">keyLength</font></strong></em></TD>
45<TD width="670">The key size.</TD>
46    </TR>
47  </table>
48<h2>Return Values</h2>
49<p>None.</p>
50<H2>Description</H2>
51<P>This function calculates an HMAC (hash message authentication code) using SHA-1. The length of the generated keyed-hash value is 160 bits, or <nobr><code>MATH_SHA1_DIGEST_SIZE (= 20)</code></nobr> bytes. Use the &quot;digest&quot; 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 <nobr><code>MATH_SHA1_DIGEST_SIZE</code></nobr>, it becomes weaker. Even if the key is larger than <nobr><code>MATH_SHA1_DIGEST_SIZE</code></nobr>, little additional strength is gained. Internally, the stack size will be the size of the <a href="MATHSHA1Context.html"><code>MATHSHA1Context</code></a> structure plus about <code>100</code> (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 <code>HMAC-SHA-1</code>. For details, see RFC 2104.
52</P>
53<h2>See Also</h2>
54<P><CODE></CODE></P>
55<H2>Revision History</H2>
56<P>
572005/04/12 Corrected Description.<br /> 2005/04/01 Initial version.
58</P>
59<hr><p>CONFIDENTIAL</p></body>
60</html>
61