<-- Previous || Up || Next -->

CRC32 String Function
Checksums Class

Public Function CRC32String( _
      ByVal vValue As Variant _
    , Optional ByVal vStartCRC As Variant _
    ) As Variant

"32-bit Cyclical Redundancy Check (CRC)"
Return the 32-bit CRC value for the characters within a string.
Unlike a checksum, the position of the characters within string vValue affects the result.
Matching CRC values are a much more reliable indicator of the accuracy of data than matching checksum values.

Examples:
    CRC32String("A") = -740712821
    CRC32String("AB") = 812207111
    CRC32String("DCBA") = -2072346770
    CRC32String("ABCD") = -619241307
    CRC32String(EveryCharacter) = 688229491
See also:
    CRC32File Function
    Checksum16 Function
    Checksum32 Function
    CRC32Init Function
vValue: String for which the 32-bit CRC value will be calculated. Function returns Null if vValue is Null or cannot be fixed up to a String.

vStartCRC: The starting CRC value. vStartCRC defaults to &HFFFFFFFF (2^32 - 1 unsigned long; -1 signed long) if it is missing or Null or cannot be fixed up to a number. The default CRC value of &HFFFFFFFF should be used in most cases where the CRC of a single string is to be calculated. This argument is provided for those cases where the CRC of a file is to be calculated one block at a time.

Note: This function returns a Long integer value which really represents an unsigned long value. The most-significant-bit of the return value really represents the most significant bit of an unsigned value; it does not represent the sign bit of a signed value. For example, negative return values represent the values within the range from 2^31 through 2^32-1.
v1.1 BugBix: Corrected a bug in this function that might have caused it to not work in v1.0. For some reason, VB 4.0 was truncating all of the Long hex Constants that were required by this function.
Tip: We suggest using Long decimal Constants (like -1&) instead of Long hex Constants (like &HFFFFFFFF) wherever possible.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.