CryptoSys API Library Manual

CRC_File

Computes the CRC-32 checksum of a file.

VBA/VB6 Syntax

Public Declare Function CRC_File Lib "diCryptoSys.dll" (ByVal strFileName As String, ByVal nOptions As Long) As Long

nRet = CRC_File(strFileName, nOptions)

C/C++ Syntax

int32_t __stdcall CRC_File(const char *szFileName, long nOptions);

Parameters

szFileName
[in] specifying the input file.
nOptions
[in] option flags: not used in this release. Specify zero.

Returns (VBA/C)

The value of the CRC-32 checksum.

.NET Equivalent

Crc.File Method

COM/ASP Equivalent

crc32.FileHex
Public Function FileHex(ByVal strFileName As String) As String

See crc32.FileHex.

C++ (STL) Equivalent

static int crsysapi::Crc::File (const std::string &fileName)

Python Equivalent

static Crc.file(filename)

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. A return value of zero probably indicates that the file could not be found, or that the file is empty. The chances of a file with random contents giving a CRC checksum of zero is one in 4.5 billion, but it is not difficult to construct a file with such a checksum.

Example

Dim nCRC As Long
nCRC = CRC_File("hello.txt", 0)
Debug.Print "CRC32('hello.txt')=" & Hex(nCRC)

See Also

CRC_Bytes CRC_String

[Contents] [Index]

[PREV: CRC_Bytes...]   [Contents]   [Index]   
   [NEXT: CRC_String...]

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