diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Crypto/HmacSha1.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,39 @@
     1.4 +// HmacSha1.h
     1.5 +// Implements HMAC-SHA-1 (RFC2104, FIPS-198)
     1.6 +
     1.7 +#ifndef __CRYPTO_HMAC_SHA1_H
     1.8 +#define __CRYPTO_HMAC_SHA1_H
     1.9 +
    1.10 +#include "Sha1.h"
    1.11 +
    1.12 +namespace NCrypto {
    1.13 +namespace NSha1 {
    1.14 +
    1.15 +// Use:  SetKey(key, keySize); for () Update(data, size); Final(mac, macSize);
    1.16 +
    1.17 +class CHmac
    1.18 +{
    1.19 +  CContext _sha;
    1.20 +  CContext _sha2;
    1.21 +public:
    1.22 +  void SetKey(const Byte *key, size_t keySize);
    1.23 +  void Update(const Byte *data, size_t dataSize) { _sha.Update(data, dataSize); }
    1.24 +  void Final(Byte *mac, size_t macSize = kDigestSize);
    1.25 +};
    1.26 +
    1.27 +class CHmac32
    1.28 +{
    1.29 +  CContext32 _sha;
    1.30 +  CContext32 _sha2;
    1.31 +public:
    1.32 +  void SetKey(const Byte *key, size_t keySize);
    1.33 +  void Update(const UInt32 *data, size_t dataSize) { _sha.Update(data, dataSize); }
    1.34 +  void Final(UInt32 *mac, size_t macSize = kDigestSizeInWords);
    1.35 +  
    1.36 +  // It'sa for hmac function. in,out: mac[kDigestSizeInWords].
    1.37 +  void GetLoopXorDigest(UInt32 *mac, UInt32 numIteration);
    1.38 +};
    1.39 +
    1.40 +}}
    1.41 +
    1.42 +#endif