CryptoSys API Library Manual

CRC_Bytes

Computes the CRC-32 checksum of an array of bytes.

VB6/VBA Syntax

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)

Parameters

abData
[in] Byte array of bytes containing input data.
nBytes
[in] Long specifying the number of bytes in the input.
nOptions
[in] Long option flags: not used in this release. Specify zero.

C/C++ Syntax

long _stdcall CRC_Bytes(const unsigned char *input, long nbytes, long options);

Returns (VB6/C)

Long: The return value is the value of the CRC-32 checksum.

.NET Equivalent

Crc.Data Method (Byte[])

Remarks

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.

Examples

    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)

See Also

CRC_String CRC_File

[Contents] [Index]

[HOME]   [NEXT: CRC_File...]

Copyright © 2001-11 D.I. Management Services Pty Ltd. All rights reserved.