view src/win32/7zip/7z/CPP/7zip/Crypto/HmacSha1.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // HmacSha1.h
2 // Implements HMAC-SHA-1 (RFC2104, FIPS-198)
4 #ifndef __CRYPTO_HMAC_SHA1_H
5 #define __CRYPTO_HMAC_SHA1_H
7 #include "Sha1.h"
9 namespace NCrypto {
10 namespace NSha1 {
12 // Use: SetKey(key, keySize); for () Update(data, size); Final(mac, macSize);
14 class CHmac
15 {
16 CContext _sha;
17 CContext _sha2;
18 public:
19 void SetKey(const Byte *key, size_t keySize);
20 void Update(const Byte *data, size_t dataSize) { _sha.Update(data, dataSize); }
21 void Final(Byte *mac, size_t macSize = kDigestSize);
22 };
24 class CHmac32
25 {
26 CContext32 _sha;
27 CContext32 _sha2;
28 public:
29 void SetKey(const Byte *key, size_t keySize);
30 void Update(const UInt32 *data, size_t dataSize) { _sha.Update(data, dataSize); }
31 void Final(UInt32 *mac, size_t macSize = kDigestSizeInWords);
33 // It'sa for hmac function. in,out: mac[kDigestSizeInWords].
34 void GetLoopXorDigest(UInt32 *mac, UInt32 numIteration);
35 };
37 }}
39 #endif