#ifndef CRC32_H
#define CRC32_H

#include <stddef.h>
#include <stdint.h>

// it needs to be declared but not implemented, otherwise, multiple definitions
// will occur
extern const uint32_t CRC32_INIT;
extern const uint32_t CRC32_TABLE[256];

typedef uint32_t ChecksumCrc32;

typedef struct Crc32 {
  ChecksumCrc32 buf;
} Crc32;

Crc32 crc32_new();
void crc32_process(const uint8_t *data, size_t len, Crc32 *crc32);

ChecksumCrc32 crc32_checksum(const uint8_t *data, uint32_t len);
ChecksumCrc32 crc32_checksum_n_times(uint32_t n, const uint8_t *data,
                                     uint32_t len);

#endif // CRC32_H
