/* ************************************************************************ ** ** Copyright (c) 2013 by ** Core|Vision B.V. ** Cereslaan 10b ** 5384 VT Heesch ** The Netherlands ** ** All Rights Reserved ** ************************************************************************ */ /* ************************************************************************ ** ** Project name: Dual Inventive: Utility Library ** Filename: cp3000-crc.h ** Author: Jack Weeland ** Date: February 26, 2013 ** File version: $Revision: 1.2 $ ** $Date: 2013/04/15 15:37:42 $ ** ************************************************************************ */ /* ************************************************************************ ** ** CRC calculation ** ************************************************************************ */ #ifndef __CP3000_CRC_H #define __CP3000_CRC_ #include /* ** Datatype */ typedef struct CP3000_CRC *cp3000_crc_t; /* ** Exported functions */ // initialisation and destruction cp3000_crc_t cp3000_crc_init(int bits, uint32_t seed, uint32_t polynomal); int cp3000_crc_deinit(cp3000_crc_t); // reset the initial seed; only needed if the same 'cp3000_crc_t' // object is reused int cp3000_crc_start(cp3000_crc_t); // calculate CRC over an array of bytes; the intermediate result // will be saved, so this function can be called repeatedly over // chuncks of data to give a CRC over the complete data set int cp3000_crc_add(cp3000_crc_t, const unsigned char*, size_t); // get the (final) result uint32_t cp3000_crc_result(cp3000_crc_t); // Perform all three steps above uint32_t cp3000_crc_calculate(cp3000_crc_t crc, const unsigned char*, size_t); #endif /* __CP3000_CRC_H */