#simd #crc #crc64 #checksum #hash

crc64fast

SIMD accelerated CRC64 calculation

3 releases (stable)

1.1.0 Jan 18, 2024
1.0.0 May 2, 2020
0.1.0 Nov 20, 2019

#233 in Hardware support

Download history 209/week @ 2024-09-09 229/week @ 2024-09-16 549/week @ 2024-09-23 621/week @ 2024-09-30 159/week @ 2024-10-07 495/week @ 2024-10-14 443/week @ 2024-10-21 358/week @ 2024-10-28 274/week @ 2024-11-04 319/week @ 2024-11-11 627/week @ 2024-11-18 384/week @ 2024-11-25 316/week @ 2024-12-02 440/week @ 2024-12-09 334/week @ 2024-12-16 224/week @ 2024-12-23

1,345 downloads per month
Used in 6 crates (3 directly)

MIT/Apache

125KB
4.5K SLoC

crc64fast

Build status Latest Version Documentation

SIMD-accelerated CRC-64/XZ (a.k.a. CRC-64/GO-ECMA) computation (similar to crc32fast).

Usage

use crc64fast::Digest;

let mut c = Digest::new();
c.write(b"hello ");
c.write(b"world!");
let checksum = c.sum64();
assert_eq!(checksum, 0x8483_c0fa_3260_7d61);

Performance

crc64fast provides two fast implementations, and the most performance one will be chosen based on CPU feature at runtime.

  • a fast, platform-agnostic table-based implementation, processing 16 bytes at a time.
  • a SIMD-carryless-multiplication based implementation on modern processors:
    • using PCLMULQDQ + SSE 4.1 on x86/x86_64
    • using PMULL + NEON on AArch64 (64-bit ARM)
Algorithm Throughput (x86_64) Throughput (aarch64)
crc 3.0.1 0.5 GiB/s 0.3 GiB/s
crc64fast (table) 2.3 GiB/s 1.8 GiB/s
crc64fast (simd) 28.2 GiB/s 20.0 GiB/s

TODO

This crate is mainly intended for use in TiKV only. Features beyond AArch64 are unlikely to be implemented.

  • AArch64 support based on PMULL
  • no_std support
  • Fuzz test
  • Custom polynomial

License

crc64fast is dual-licensed under

No runtime deps