/******************************************************************************* * CRC32 calculator ******************************************************************************/ #ifndef _CRC32_H #define _CRC32_H /******************************************************************************* * INCLUDED FILES ******************************************************************************/ #include /******************************************************************************* * PUBLIC TYPES ******************************************************************************/ /** * CRC32 object context. * * In fact, we could even put it into source file instead of header file, * but then we can allocate it in heap only, which might not be good idea, * especially in embedded world. */ struct S_Crc32 { uint32_t crc; }; /******************************************************************************* * CONSTRUCTOR, DESTRUCTOR ******************************************************************************/ void crc32_ctor(struct S_Crc32 *me); void crc32_dtor(struct S_Crc32 *me); /******************************************************************************* * PUBLIC METHOD PROTOTYPES ******************************************************************************/ /** * Feed next byte to crc32 */ void crc32_byte_feed(struct S_Crc32 *me, uint8_t byte); /** * Get current crc32 value */ uint32_t crc32_value_get(const struct S_Crc32 *me); /******************************************************************************* * end of file ******************************************************************************/ #endif /* _CRC32_H */