Skip to content

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

License

Notifications You must be signed in to change notification settings

awesomized/crc32fast-lib-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crc32fast-lib

Tests Latest Version Documentation

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.

Changes

See the change log.

Usage

cargo build will produce a shared library target (.so on Linx, .dll on Windows, .dylib on macOS, etc) and a C header file.

Use the header file and library as you would normally when using a shared library in your language of choice.

PHP example

/** \FFI $ffi */

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

References

  • crc32fast - The underlying Rust library which implemented this SIMD-accelerated approach.
  • crc-fast-php - An implementation of this library in PHP using FFI.
  • crc64fast-nvme - A similar project which computes CRC-64/NVME checksums at >20GiB/s, also with a C-compatible shared library.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published