Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

AxPipe::Stock::CPipeHMAC_SHA1< iBits > Class Template Reference

Calculate HMAC-SHA1-128 or 160 from a data-stream. More...

#include <CPipeHMAC_SHA1.h>

Inheritance diagram for AxPipe::Stock::CPipeHMAC_SHA1< iBits >:

Inheritance graph
[legend]
Collaboration diagram for AxPipe::Stock::CPipeHMAC_SHA1< iBits >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

CPipeHMAC_SHA1< iBits > * Init (TBits< iBits > *pKey, size_t cbOffset=0)
 Initialize the key and possibly an offset when to start HMAC'ing.


Protected Member Functions

void Out (CSeg *pSeg)
 Hash and pass onwards.

bool OutOpen ()
 Do the inner wrap.

bool OutClose ()
 Do the outer wrap.


Private Member Functions

void XorPad (unsigned char oPad)
 Helper for the inner and outer padding and Xor.


Private Attributes

TBits< 160 > m_HMAC
 HMAC intermediate.

TBits< iBits > m_Key
 The key provied in Init().

size_t m_cbOffset
 Offset from where to start HMAC'ing.


Detailed Description

template<int iBits>
class AxPipe::Stock::CPipeHMAC_SHA1< iBits >

Calculate HMAC-SHA1-128 or 160 from a data-stream.

Define the bitlength in the template instantiation.

Definition at line 42 of file CPipeHMAC_SHA1.h.


Member Function Documentation

template<int iBits>
CPipeHMAC_SHA1< iBits > * AxPipe::Stock::CPipeHMAC_SHA1< iBits >::Init TBits< iBits > *  pKey,
size_t  cbOffset = 0
 

Initialize the key and possibly an offset when to start HMAC'ing.

Initialize the key and the offset.

Parameters:
pKey A TBits comprising the key of the HMAC operation.
cbOffset The number of bytes to skip in the stream before beginning
Returns:
A pointer to 'this'

Definition at line 64 of file CPipeHMAC_SHA1.cpp.

References AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_cbOffset, and AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_Key.

template<int iBits>
void AxPipe::Stock::CPipeHMAC_SHA1< iBits >::Out AxPipe::CSeg pSeg  )  [protected, virtual]
 

Hash and pass onwards.

Hash the data into the HMAC, skipping if necessary. All data is passed unchanged, although segment boundaries may change.

Parameters:
pSeg The segment to hash, unless we're still skipping

Reimplemented from AxPipe::Stock::CPipeSHA1.

Definition at line 75 of file CPipeHMAC_SHA1.cpp.

References AxPipe::CSeg::Clone(), AxPipe::CSeg::Drop(), AxPipe::CSeg::Len(), AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_cbOffset, and AxPipe::CPipe::Pump().

template<int iBits>
bool AxPipe::Stock::CPipeHMAC_SHA1< iBits >::OutClose void   )  [protected, virtual]
 

Do the outer wrap.

Do the outer hash of the padded and XOR'ed key, and also finalize the HMAC in the form of a hash. You get the hash by calling GetHash(), and the number of bytes processed with CountBytes().

Returns:
true if the Open() call should be cascaded.

Reimplemented from AxPipe::Stock::CPipeSHA1.

Definition at line 113 of file CPipeHMAC_SHA1.cpp.

References ASSAPI, AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_HMAC, and AxPipe::Stock::CPipeHMAC_SHA1< iBits >::XorPad().

template<int iBits>
bool AxPipe::Stock::CPipeHMAC_SHA1< iBits >::OutOpen  )  [protected, virtual]
 

Do the inner wrap.

Do the inner hash of the padded and XOR'ed key

Returns:
true if the Open() call should be cascaded.

Reimplemented from AxPipe::Stock::CPipeSHA1.

Definition at line 96 of file CPipeHMAC_SHA1.cpp.

References ASSAPI, AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_HMAC, and AxPipe::Stock::CPipeHMAC_SHA1< iBits >::XorPad().

template<int iBits>
void AxPipe::Stock::CPipeHMAC_SHA1< iBits >::XorPad unsigned char  oPad  )  [private]
 

Helper for the inner and outer padding and Xor.

Do the HMAC XOR operation, with the inner or outer pad. Basically its the value XOR the Key, but if the key is shorter, we simulate zero-extending it.

Parameters:
oPad The byte to XOR the Key with.

Definition at line 49 of file CPipeHMAC_SHA1.cpp.

References AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_HMAC, and AxPipe::Stock::CPipeHMAC_SHA1< iBits >::m_Key.

Referenced by AxPipe::Stock::CPipeHMAC_SHA1< iBits >::OutClose(), and AxPipe::Stock::CPipeHMAC_SHA1< iBits >::OutOpen().


The documentation for this class was generated from the following files:
Generated on Mon Feb 2 13:19:29 2004 for AxPipe by doxygen 1.3.5