2017-10-31 11:40:07 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "pkg2zip_utils.h"
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2017-10-31 15:18:41 -07:00
|
|
|
uint32_t PKG_ALIGN(16) crc[4 * 5];
|
2017-10-31 11:40:07 -07:00
|
|
|
} crc32_ctx;
|
|
|
|
|
|
|
|
|
|
void crc32_init(crc32_ctx* ctx);
|
|
|
|
|
void crc32_update(crc32_ctx* ctx, const void* buffer, size_t size);
|
|
|
|
|
uint32_t crc32_done(crc32_ctx* ctx);
|
2017-11-09 22:25:40 -08:00
|
|
|
|
|
|
|
|
// returns crc32(x||y)
|
|
|
|
|
// where a=crc32(x) and b=crc32(y)
|
|
|
|
|
// crc32(x||y) = crc32(x||z) ^ crc32(y), where z=00...00 (same length as y)
|
|
|
|
|
uint32_t crc32_combine(uint32_t a, uint32_t b, uint32_t blen);
|