The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



CRC32ofBuffer


Unit:SDL_dstruct
Class:none
Declaration:function CRC32ofBuffer (Buffer: TBytes; NumData: integer): longint;

The function CRC32ofBuffer calculates a 32-bit CRC of the byte array Buffer; the algorithm is based on the following polynomial:

X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1.

The parameter Numdata specifies the number of bytes contained in the buffer. All NumData bytes in the buffer are processed and the cyclic redundancy code is returned by the function.

Example: The expression "crc32 := CRC32ofBuffer(@astring[1], length(astring));" generates the CRC of the string astring and fills the variable crc32 with the result.

Please note that the string variable astring has to be a zero terminated long string (must not be a string of type ShortString).



Last Update: 2023-Feb-06