Crate crc32fast_lib

Source
Expand description

§crc32fast-lib

Fast, SIMD-accelerated CRC-32/ISO-HDLC (aka crc32) checksum computation in Rust exposed as a C-compatible shared library.

Results in a dramatic performance improvement. For example, when using it via FFI in PHP, it’s >10X faster than PHP’s native crc32 implementation.

§Usage

§PHP example

$hasher = $ffi->hasher_new();
$ffi->hasher_write($hasher, 'hello world!', 12);
$checksum = $ffi->hasher_finalize($hasher); // 0x03b4c26d

Structs§

HasherHandle
Opaque type for C for use in FFI

Functions§

crc32_hash
Helper method to just calculate a CRC32 checksum directly for a string
hasher_finalize
Calculates the CRC32 checksum for data that’s been written to the Hasher
hasher_new
Creates a new Hasher to compute CRC32 checksums
hasher_write
Writes data to the Hasher