34 TRACE(
"Entering aaruf_crc64_init()");
41 TRACE(
"Exiting aaruf_crc64_init()");
57 TRACE(
"Entering aaruf_crc64_update(%p, %p, %u)", ctx, data, len);
60 TRACE(
"Exiting aaruf_crc64_update() = -1");
64#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
65 defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
68 ctx->
crc = ~aaruf_crc64_clmul(~ctx->
crc, data, len);
70 TRACE(
"Exiting aaruf_crc64_update() = 0");
75#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
78 ctx->
crc = ~aaruf_crc64_vmull(~ctx->
crc, data, len);
80 TRACE(
"Exiting aaruf_crc64_update() = 0");
91 TRACE(
"Exiting aaruf_crc64_update() = 0");
104 uint64_t c = *previous_crc;
108 const uint8_t *limit = NULL;
110 while((uintptr_t)data & 3)
116 limit = data + (len & ~(uint32_t)3);
121 const uint32_t tmp = c ^ *(
const uint32_t *)data;
129 while(len-- != 0) c =
crc64_table[0][*data++ ^ c & 0xFF] ^ c >> 8;
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
void aaruf_crc64_free(crc64_ctx *ctx)
Frees a CRC64 context.
void aaruf_crc64_slicing(uint64_t *previous_crc, const uint8_t *data, uint32_t len)
Updates a CRC64 value using the slicing-by-8 algorithm.
uint64_t aaruf_crc64_data(const uint8_t *data, const uint32_t len)
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
crc64_ctx * aaruf_crc64_init(void)
Initializes a CRC64 context.
static const uint64_t crc64_table[4][256]
Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).
#define CRC64_ECMA_SEED
ECMA-182 initial seed (all bits set).
Minimal ECMA-182 CRC64 incremental state container (running value only).
uint64_t crc
Running CRC value (initialize to CRC64_ECMA_SEED before first update).