Computes the CRC-32 checksum of an array of bytes.
Public Declare Function CRC_Bytes Lib "diCryptoSys.dll"
(ByRef abInput As Byte, ByVal nBytes As Long, ByVal nOptions As Long) As Long
nRet = CRC_Bytes(abData(0), nBytes, nOptions)
Byte array of bytes containing input data.Long specifying the number of bytes in the input.Long option flags: not used in this release. Specify zero.
long _stdcall CRC_Bytes(const unsigned char *input, long nbytes, long options);
Long: The return value is the value of the CRC-32 checksum.
Crc.Data Method (Byte[])
Note the "(0)" in abData(0).
The CRC-32 checksum may be a positive or negative number and is usually represented in hexadecimal.
The CRC-32 algorithm uses the polynomial 0x04C11DB7 and is the one specified in ISO 3309 and ITU-T V.42 and used by WinZip.
Dim abData() As Byte
Dim nLen As Long
Dim nCRC As Long
Dim i As Long
nLen = 9
ReDim abData(nLen - 1)
' Create a 9-byte array equal to "123456789"
For i = 0 To nLen - 1
abData(i) = i + Asc("1")
Next
nCRC = CRC_Bytes(abData(0), nLen, 0)
Debug.Print "CRC32=" & Hex(nCRC)