QuickHash Library Type Library

HMAC_CalculateStr

int HMAC_CalculateStr( [ in ] int nAlgID, [ out ]HMAC_Digest* pDigest, [ in,string ]unsigned char* pSrc, [ in, string ]unsigned char* pKey );

Return value

Nonzero if calculation is successful, otherwise 0. In particular, this function returns 0 when nAlgID is invalid.

Parameters

nAlgID

    [in] The ID of the hash algorithm selected for calculations. For example, nAlgID has to be set to SHA1_ALGID when you need to calculate the HMAC using SHA-1 hash algorithm.

    Note. All supported hash algorithms with their corresponding IDs are specified in the Predefined Constants List.

 pDigest

    [out] A memory buffer that will receive the HMAC.

     Note. All predefined types are specified in the Predefined Types List.

 pSrc

    [in] A null-terminated string for which to calculate the HMAC.

pKey

    [in] The key which represents a null-terminated string.

Remarks

Calculates the HMAC for the null-terminated string specified by pSrc using the key specified by pKey. The HMAC is retrieved in the pDigest memory buffer.

VB Example

Private Sub MyButton_Click()   
    Dim Hmac As HMAC_Digest
    Dim MyStrData As String
    MyStrData = "Hello World!"
    Dim MyStrKey As String
    MyStrKey = "password"
    'Get the MD5-HMAC
    HMAC_CalculateStr MD5_ALGID, Hmac, MyStrData, MyStrKey
    'Show the hexadecimal representation of the MD5-HMAC
    MsgBox QHASH_ConvertToHex(Hmac.Value(0), MD5_DIGESTSIZE, True)
End Sub

Type Library Overview   |   Type Library Functions   |   Useful Links   |   HashCalc

 

See Also    HMAC_CalculateStrHex, HMAC_Calculate, HMAC_CalculateHex, QHASH_ConvertToHex


 

 

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