CryptoSys API Library Manual

MD5_BytesHexHash

Creates an MD5 message digest in hexadecimal format from a message in Byte array format.

VBA/VB6 Syntax

Public Declare Function MD5_BytesHexHash Lib "diCryptoSys.dll" (ByVal strDigest As String, ByRef lpData As Byte, ByVal nDataLen As Long) As Long

nRet = MD5_BytesHexHash(strDigest, abData(0), nDataLen) ' Note the "(0)" after the byte array parameters

C/C++ Syntax

long __stdcall MD5_BytesHexHash(char *szDigest, const unsigned char *lpData, long nDataLen);

Parameters

szDigest
[out] to receive message digest.
lpData
[in] array containing the message to be hashed.
nDataLen
[in] containing number of bytes in the array.

Returns (VBA/C)

If successful, the return value is 0; otherwise it returns a non-zero error code.

.NET Equivalent

Md5.HexHash Method (Byte[])

COM/ASP Equivalent

md5.HexHexHash
Public Function HexHexHash(ByVal strHexData As String) As String

See md5.HexHexHash.

Remarks

szDigest must be at least 32 (API_MAX_MD5_CHARS) characters long (33 in a C program).

Example

    Dim nRet As Long
    Dim abData(2) As Byte   ' Create 3-byte array (NB zero-based)
    ' Alternative way of making sure string is 32 chars long
    Dim strDigest As String * 32

    ' Setup byte array with "abc"
    abData(0) = Asc("a")
    abData(1) = Asc("b")
    abData(2) = Asc("c")

    nRet = MD5_BytesHexHash(strDigest, abData(0), 3)
    Debug.Print nRet; strDigest

This should result in output as follows:

 0 900150983cd24fb0d6963f7d28e17f72

See Also

MD5_StringHexHash MD5_FileHexHash

[Contents] [Index]

[PREV: MD5_BytesHash...]   [Contents]   [Index]   
   [NEXT: MD5_FileHexHash...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.