JCL Help:InitCrc32@Cardinal@Cardinal

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Defines a new polynomial and starting value for the 32 bit CRC functions.


Pascal

 procedure InitCrc32(Polynom: Cardinal; Start: Cardinal); overload;
procedure InitCrc32(Polynom: Cardinal; Start: Cardinal; out Crc32Table: TCrc32Table); overload;


Parameters

Parameters Description
Start: Cardinal 32 bit starting value to be used with subsequent calls to 32 bit CRC functions
polynomial Generator polynomial to be used with subsequent calls to 32 bit CRC functions. The polynomial is given without the highest bit (bit x^32)


Description

Defines a new "generator polynomial" and starting value for the 32 bit CRC functions. Beware that the check and the correction only works if the polynomial is "appropriate". Two of these polynomials are predefined: Crc32PolynomCCITT = $04C11DB7 represents the polynomial x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 that is suggested by the CCITT and used by Ethernet and ZIP. Crc32PolynomXXXXX = $9DB11213 represents the polynomial x^32 + x^31 + x^28 + x^27 + x^26 + x^24 + x^23 + x^21 + x^20 + x^16 + x^12 + x^9 + x^4 + x + 1 which is another "appropriate" polynomial (as far as I know). Beware that not appropriate polynomials result in highly undesirable behaviour of the CRC. The starting value can by anything. $FFFFFFFF and 0 are usual definitions.


See Also

Crc32 CheckCrc32 InitCrc16


About

Unit

JclMath


Donator

Michael Schnell


Notes

As a standard in the JEDI Code Library the compiler option {$J-} is set to prevent modifying typed constants. So the function CRC32Init only exists if JCLMath is recompiled with the compiler environment variable "CRCINIT" defined, which temporarily sets {$J+} for the CRC functions.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page