QuickHash Library Type Library


int QHASH_BlockDigest( [ in ]int nAlgID, [ out ]QHASH_Digest *pDigest,[ in, size_is( nSrcLength ) ]const void* pSrc, [ in ] int nSrcLength );

Return value

Zero if calculation is successful, otherwise nonzero.

Note. All possible return values are specified in the Error Codes List.



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

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


    [out] The memory buffer that will receive the message digest/checksum.

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


    [in] A continuous memory block for which to calculate the message digest/checksum.


    [in] Length in bytes of the memory block.


Calculates the message digest/checksum for a continuous memory block. The digest/checksum is retrieved in the pDigest memory buffer.

VB Example

Private Sub MyButton_Click()
    Dim Digest As QHASH_Digest
    Dim MyStrData As String
    MyStrData = "Hello World!"
    Dim nLen As Long
    nLen = Len(MyStrData)
    'Convert the string to byte array
    Dim MyBinData() As Byte
    ReDim MyBinData(1 To nLen)
    For i = 1 To nLen
        MyBinData(i) = Asc(Mid(MyStrData, i, 1))
    Next i
    'Calculate the digest 
    QHASH_BlockDigest MD5_ALGID, Digest, MyBinData(1), nLen
    'Show the digest in hexadecimal representation
    MsgBox QHASH_ConvertToHex(Digest.Value(0), MD5_DIGESTSIZE, True) 
End Sub



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


See Also    QHASH_BlockHexDigest, QHASH_StringDigest, QHASH_FileDigest, QHASH_ConvertToHex



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