|
QuickCrypt Library |
C++ Interface |
|
CCounterMode::CCounterMode
CCounterMode( const unsigned char* pIV,
const unsigned char* pKey, unsigned int nKeyLen =
DEFAULTKEYSIZE );
Parameters
pIV
[in] Pointer to the
initialization vector.
pKey
[in] Pointer to the secret
key.
nKeyLen
[in] Length in bytes of the
secret key.
Remarks
Constructs a CCounterMode object and
initializes it with the initialization vector pointed by pIV, and
the secret key pointed by
pKey.
Notes.
-
The first
CCounterMode<T>::BLOCKSIZE
bytes of the memory
buffer pointed by pIV are
used as the initialization vector.
-
nKeyLen can be
CCounterMode<T>::DEFAULTKEYKSIZE
bytes. For Rijndael (AES) algorithm it can also be 24 or 32 bytes. For Blowfish algorithm it can be in the range 1 through
72 bytes.
Example
//Define the key
char key[CDES::DEFAULTKEYSIZE] =
{
'p', 'a', 's', 's', 'w', 'o', 'r', 'd'
};
//Define the initialization vector
unsigned char iv[CDES::BLOCKSIZE] =
{
0x41, 0x3E, 0xF0, 0xA1, 0xC6, 0x11, 0xE5, 0x50
};
//Declare a local CCounterMode object that will use DES encryption algorithm
CCounterMode<CDES> cipher( iv, (const unsigned char*)key );
//Declare a dynamic CCounterMode object that will use the DES encryption algorithm
CCounterMode<CDES>* pCipher = new CCounterMode<CDES>( iv, (const unsigned char*)key );
|
|
CCounterMode Overview
| Class Members
| Useful Links
See Also CCounterMode::Process,
CCounterMode::Seek
|