2 .TH crc32 3 "8 May 1999" "mLib"
4 crc32 \- calculate 32-bit CRC
8 .B "#include <mLib/crc32.h>"
10 .BI "int crc32(unsigned long " crc ", const void *" buf ", size_t " sz );
11 .BI CRC32( result ", " crc ", " buf ", " sz )
16 function calculates a 32-bit cyclic redundancy check of the data block
23 The function is restartable. For a first call, pass zero as the value
26 argument; for subsequent blocks, pass in the previous output. The final
27 answer is equal to the result you'd get from computing a CRC over the
28 concatenation of the individual blocks.
32 macro calculates a CRC inline. The calculated CRC value is placed in
35 Only use the macro version when efficiency is a major concern: it makes
36 the code rather harder to read.
38 Note that a CRC is not cryptographically strong: it's fairly easy for an
39 adversary to construct blocks of data with any desired CRC, or to modify
40 a given block in a way which doesn't change its (unknown) CRC.
42 The exact behaviour of the CRC is beyond the scope of this manual;
43 suffice to say that the result is, in some suitable representation, the
44 remainder after division in the finite field GF(2^32) of the block by a
45 carefully chosen polynomial of order 32.
47 The return value is the 32-bit CRC of the input block.
51 Mark Wooding, <mdw@nsict.org>