Lightweight CRC16 checksum algorithms.
More...
This CRC16 implementation does not use precalculated lookup tables and is thus very lightweight (memorywise), but as a caveat slower (about factor 8) than the version with precalculated lookup tables.
Additionally compared to CRC16CCITT this is a generalized implementation. One can easily exchange generator polynomials and starting seeds.
#define UCRC16_CCITT_POLY_BE (0x1021) 
CRC16CCITT polynomial (bigendian)
Definition at line 43 of file ucrc16.h.
uint16_t ucrc16_calc_be 
( 
const uint8_t * 
buf, 


size_t 
len, 


uint16_t 
poly, 


uint16_t 
seed 

) 
 
 Parameters

[in]  buf  Start of memory are to checksum 
[in]  len  Number of bytes in buf to calculate checksum for 
[in]  poly  The generator polynomial for the checksum 
[in]  seed  The seed (starting value) for the checksum 
 Returns
 Checksum of the specified memory area based on
seed
and poly
 Note
 The return value is not the complement of the sum but the sum itself
uint16_t ucrc16_calc_le 
( 
const uint8_t * 
buf, 


size_t 
len, 


uint16_t 
poly, 


uint16_t 
seed 

) 
 
 Parameters

[in]  buf  Start of memory are to checksum 
[in]  len  Number of bytes in buf to calculate checksum for 
[in]  poly  The generator polynomial for the checksum 
[in]  seed  The seed (starting value) for the checksum 
 Returns
 Checksum of the specified memory area based on
seed
and poly
 Note
 The return value is not the complement of the sum but the sum itself