QuickHash Library
QuickHash Library Overview
QuickHash Library Applications
QuickHash Library Installation
Register QuickHash Library
CMD2 ( C++ Interface )
CMD2 class members
MD2 API ( QuickHash API )
MD2 API Functions
MD2 ( QuickHash Type Library )
CMD4 ( C++ Interface )
CMD4 class members
MD4 API ( QuickHash API )
MD4 API Functions
MD4 ( QuickHash Type Library )
CMD5 ( C++ Interface )
CMD5 class members
MD5 API ( QuickHash API )
MD5 API Functions
MD5 ( QuickHash Type Library )
CSHA1 ( C++ Interface )
CSHA1 class members
SHA1 API ( QuickHash API )
SHA1 API Functions
SHA1 ( QuickHash Type Library )
SHA-2 (256)
CSHA256 ( C++ Interface )
CSHA256 class members
SHA256 API ( QuickHash API )
SHA256 API Functions
SHA256 ( QuickHash Type Library )
SHA-2 (384)
CSHA384 ( C++ Interface )
CSHA384 class members
SHA384 API ( QuickHash API )
SHA384 API Functions
SHA384 ( QuickHash Type Library )
SHA-2 (512)
CSHA512 ( C++ Interface )
CSHA512 class members
SHA512 API ( QuickHash API )
SHA512 API Functions
SHA512 ( QuickHash Type Library )
CRIPEMD128 ( C++ Interface )
CRIPEMD128 ( C++ Interface )
RIPEMD128 API ( QuickHash API )
RIPEMD128 API Functions
RIPEMD128 ( QuickHash Type Library )
CRIPEMD160 ( C++ Interface )
CRIPEMD160 ( C++ Interface )
RIPEMD160 API ( QuickHash API )
RIPEMD160 API Functions
RIPEMD160 ( QuickHash Type Library )
CRIPEMD256 ( C++ Interface )
CRIPEMD256 ( C++ Interface )
RIPEMD256 API ( QuickHash API )
RIPEMD256 API Functions
RIPEMD256 ( QuickHash Type Library )
CRIPEMD320 ( C++ Interface )
CRIPEMD320 ( C++ Interface )
RIPEMD320 API ( QuickHash API )
RIPEMD320 API Functions
RIPEMD320 ( QuickHash Type Library )
CPanama ( C++ Interface )
CPanama class members
PANAMA API ( QuickHash API )
PANAMA API Functions
PANAMA ( QuickHash Type Library )
CTiger class members
TIGER API ( QuickHash API )
TIGER API Functions
TIGER ( QuickHash Type Library )
CCRC16 ( C++ Interface )
CCRC16 class members
CRC16 API ( QuickHash API )
CRC16 API Functions
CRC16 ( QuickHash Type Library )
CCRC16C ( C++ Interface )
CCRC16C class members
CRC16C API ( QuickHash API )
CRC16C API Functions
CRC16C ( QuickHash Type Library )
CCRC32 ( C++ Interface )
CCRC32 class members
CRC32 API ( QuickHash API )
CRC32 API Functions
CRC32 ( QuickHash Type Library )
CAdler32 ( C++ Interface )
CAdler32 class members
ADLER32 API ( QuickHash API )
ADLER32 API Functions
ADLER32 ( QuickHash Type Library )
CHMAC ( C++ Interface )
CHMAC class members
HMAC API ( QuickHash API )
HMAC API Functions
HMAC ( QuickHash Type Library )
QuickHash Type Library
Type Library Overview
Type Library Functions
Type Library Constants
Type Library Types
Type Library Error Codes
QuickHash Library Run-Time Dynamic Linking
Function Indicies in QuickHash.dll
License Agreement

SlavaSoft QuickHash Library Online Help

Prev Page Next Page
QuickHash Library C++ Interface


void Init( const unsigned char* pKey, unsigned int nKeyLength = DEFAULTKEYLEN );

void Init( const char* pKey );




    In the first case - pointer to the continuous memory block used as the key.

    In the second case - pointer to the null-terminated string used as the key.


    [in] Length in bytes of the key.  


Initializes the CHMAC object with the key pointed by pKey.



#include <string.h>
#include <QuickHash.h>
using namespace QuickHash;

int main()
    char string[] = "Test String";
    char key[] = "Password";
    char newkey[] = "New Password";

    char hmachex[ CHMAC<CRIPEMD160>::HEXDIGESTSIZE ]; //0 terminated

    //Instantiate a CHMAC object that uses RIPEMD160 hash algorithm

    CHMAC<CRIPEMD160> hm( (const unsigned char*)key, strlen( key ) );

    //Calculate the HMAC using Update and FinalHex

    hm.Update( (const unsigned char*)string, strlen( string ) );
    hm.FinalHex( hmachex ); //FinalHex reinitializes the hm object for the next use 

    //Use the HMAC

    //Initialize the hm object with the new key

    hm.Init( (const unsigned char*)newkey, strlen( newkey ) );

    //Calculate the HMAC using Update and FinalHex

    hm.Update( (const unsigned char*)string, strlen( string ) );
    hm.FinalHex( hmachex ); //FinalHex reinitializes the hm object for the next use 

    //Use the HMAC

    return 0;




In the above example newkey is a null-terminated string. Therefore, the call

    hm.Init( (const unsigned char*)newkey, strlen( newkey ) );

can be replaced by

    hm.Init( newkey );


CHMAC Overview   |   Class Members   |   Useful Links   |   HashCalc


See Also    CHMAC::Update, CHMAC::Final, CHMAC::FinalHex



Send Feedback to SlavaSoft Inc. Tell a friend about QuickHash Library