Creates a SHA-1 message digest in hexadecimal format
from a message in Byte array format.
Public Declare Function SHA1_BytesHexHash Lib "diCryptoSys.dll"
(ByVal strDigest As String, ByRef abData As Byte, ByVal nDataLen As Long) As Long
nRet = SHA1_BytesHexHash(strDigest, abData(0), nDataLen)
String to receive message digest.Byte array containing the message to be hashed.Long containing number of bytes in the array.
long _stdcall SHA1_BytesHexHash(char *strDigest, const unsigned char *bytes, long len);
Long: If successful, the return value is 0;
otherwise it returns a non-zero error code.
Sha1.HexHash Method (Byte[])
sha1.HexHexHash
Public Function HexHexHash(ByVal strHexData As String) As String
See sha1.HexHexHash.
strDigest must be at least 40 (API_MAX_SHA1_CHARS) characters long (41 in a C program).
VB6/VBA users: Note the '(0)' in abData(0).
Dim nRet As Long
Dim abData(2) As Byte ' Create 3-byte array (NB zero-based)
' Alternative way of making sure string is 40 chars long
Dim strDigest As String * 40
' Setup byte array with "abc"
abData(0) = Asc("a")
abData(1) = Asc("b")
abData(2) = Asc("c")
nRet = SHA1_BytesHexHash(strDigest, abData(0), 3)
Debug.Print nRet; strDigest
This should result in output as follows:
0 a9993e364706816aba3e25717850c26c9cd0d89d
SHA1_StringHexHash
SHA1_FileHexHash