Rust improved implementation of the Slice-by-8 intel algorithm from the paper "A Systematic Approach to building High Performance, Software-based, CRC Generators By Intel Researche and Development"
Slice-by-8 do not load the standard library (a.k.a #![no_std])
Status
Table of contents
Introduction
Slice-by-8 crate provides function that performs CRC hashing using improved variant of intel's Slice-by-8 algorithm.
The crate provides the slice-by-8 algorithm that take the loopup table to use as parameter if you want to use your own.
The crate also provides the CRC32 (Polynomial 0x04c11db7 ) available in slice_by_8::crc32 and the CRC32c (Polynomial 0x1EDC6F41 ) in slice_by_8::crc32c.
CRC32c hash can use CRC32c intrinsics if enabled. You can enable intrinsic version on x86_64 target_arch by enabling sse4.2 target_feature or on aarch64 target_arch by enabling crc target_feature.
Usage
Using Hasher
use CRC32BuildHasher;
use HashMap;
const KEY: &str = "hash";
const VALUE: &str = "me!";
// Create a HashMap that use CRC32Hasher to hash keys
let mut map = with_hasher;
map.insert;
assert_eq!;
Using slice-by-8 functions
Slice-by-8 provides functions to hash slice of bytes.
use crc32c;
const HASH_ME: & = b"abcdefghijklmnopqrstuvwxyz";
assert_eq!;
Note: slice_by_8 is a similar to slice_by_8_with_seed with seed equals 0.
Using your own lookup table
You own lookup table must be [[u32; 256]; 8].
use slice_by_8;
let my_lookup_table: = generate_table;
const HASH_ME: & = b"abcdefghijklmnopqrstuvwxyz";
assert_eq!;
Generate Lookup table
The crate provide generate_table function to generate a lookup table from a polynomial.
use generate_table;
use ;
assert_eq!;
assert_eq!;
Performance
Improvement are based on :