Calculates the CRC-32 value of a byte sequence. This 32bit cyclic redundancy check value is used to determine errors caused by noise in I/O channels. The input data data is considered a large binary number is divided by a certain value which is called the “generator polynomial”. The remainder with some adaption made to it is considered the result.
CRC-32 | Calculates the CRC-32 value of a byte sequence. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file CRC-32. |
C-kern/ | Implementation file CRC-32 impl. |
Types | |
struct crc32_t | Export crc32_t into global namespace. |
Functions | |
CRC-32 | |
calculate_crc32 | Calculates the CRC-32 checkusm of a data block. |
test | |
unittest_math_hash_crc32 | Test crc32_t functionality. |
crc32_t | Type which captures the partially calculated checksum. |
value | The crc32 value calculated from a sequence of bytes. |
lifetime | |
crc32_INIT | Static initializer. |
init_crc32 | Initializes object of type crc32_t. |
calculate | |
update_crc32 | Udates the CRC-32 checksum with the next chunk of data. |
update2_crc32 | Internally used function from update_crc32 and calculate_crc32. |
query | |
value_crc32 | Return the CRC32 checksum. |
inline implementation | |
Functions | |
define calculate_crc32 | Implements calculate_crc32. |
crc32_t | |
init_crc32 | Implements crc32_t.init_crc32. |
value_crc32 | Implements crc32_t.value_crc32. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2013 Jörg Seebohn
Header file CRC-32.
Implementation file CRC-32 impl.
typedef struct crc32_t crc32_t
Export crc32_t into global namespace.
CRC-32 | |
calculate_crc32 | Calculates the CRC-32 checkusm of a data block. |
test | |
unittest_math_hash_crc32 | Test crc32_t functionality. |
uint32_t calculate_crc32( size_t blocksize, const void * datablock/*[blocksize]*/ )
Calculates the CRC-32 checkusm of a data block. Use type crc32_t if data bytes are not stored in consecutive memory addresses.
int unittest_math_hash_crc32( void )
Test crc32_t functionality.
struct crc32_t
Type which captures the partially calculated checksum.
Use init_crc32 to initialize it. Call update_crc32 either once or if your data is splitted over several blocks for every block once. Call value_crc32 to get the computed CRC-32 checksum value.
value | The crc32 value calculated from a sequence of bytes. |
lifetime | |
crc32_INIT | Static initializer. |
init_crc32 | Initializes object of type crc32_t. |
calculate | |
update_crc32 | Udates the CRC-32 checksum with the next chunk of data. |
update2_crc32 | Internally used function from update_crc32 and calculate_crc32. |
query | |
value_crc32 | Return the CRC32 checksum. |
uint32_t value
The crc32 value calculated from a sequence of bytes. The value will be updated every time update_crc32 is called.
void init_crc32( /*out*/crc32_t * crc )
Initializes object of type crc32_t.
uint32_t update2_crc32( uint32_t crcvalue, size_t blocksize, const void * datablock/*[blocksize]*/ )
Internally used function from update_crc32 and calculate_crc32.
uint32_t value_crc32( const crc32_t * crc )
Return the CRC32 checksum. The calculated value is the checksum of the concatenated byte sequence of successive calls to update_crc32. To start a new computation call init_crc32 before calling update_crc32. But calling init_crc32 also sets the CRC value to 0 which is returned by this function.
Functions | |
define calculate_crc32 | Implements calculate_crc32. |
crc32_t | |
init_crc32 | Implements crc32_t.init_crc32. |
value_crc32 | Implements crc32_t.value_crc32. |
Implements calculate_crc32.
Implements crc32_t.init_crc32.
Implements crc32_t.value_crc32.
Export crc32_t into global namespace.
typedef struct crc32_t crc32_t
Type which captures the partially calculated checksum.
struct crc32_t
Calculates the CRC-32 checkusm of a data block.
uint32_t calculate_crc32( size_t blocksize, const void * datablock/*[blocksize]*/ )
Test crc32_t functionality.
int unittest_math_hash_crc32( void )
The crc32 value calculated from a sequence of bytes.
uint32_t value
Static initializer.
#define crc32_INIT { (uint32_t)-1 }
Initializes object of type crc32_t.
void init_crc32( /*out*/crc32_t * crc )
Udates the CRC-32 checksum with the next chunk of data.
void update_crc32( crc32_t * crc, size_t blocksize, const void * datablock/*[blocksize]*/ )
Internally used function from update_crc32 and calculate_crc32.
uint32_t update2_crc32( uint32_t crcvalue, size_t blocksize, const void * datablock/*[blocksize]*/ )
Return the CRC32 checksum.
uint32_t value_crc32( const crc32_t * crc )