CryptoSys API Library Manual

CRC_Bytes

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

VBA/VB6 Syntax

Public Declare Function CRC_Bytes Lib "diCryptoSys.dll" (ByRef lpInput As Byte, ByVal nBytes As Long, ByVal nOptions As Long) As Long

nRet = CRC_Bytes(abData(0), nBytes, nOptions) ' Note the "(0)" after the byte array parameters

C/C++ Syntax

int32_t __stdcall CRC_Bytes(const unsigned char *lpInput, long nBytes, long nOptions);

Parameters

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

Returns (VBA/C)

The value of the CRC-32 checksum.

.NET Equivalent

Crc.Data Method (Byte[])

C++ (STL) Equivalent

static int crsysapi::Crc::Bytes (const bvec_t &data)

Python Equivalent

static Crc.bytes(data)

Remarks

The CRC-32 checksum is a 32-bit integer value. 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]

[PREV: COMPR_Uncompress...]   [Contents]   [Index]   
   [NEXT: CRC_File...]

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