GitXplorerGitXplorer
s

rust-gearhash

public
23 stars
4 forks
0 issues

Commits

List of commits on branch master.
Unverified
adad44e7141cfd29d898cf6e0858f50b995db286

release 0.1.3

ssrijs committed 5 years ago
Unverified
3aa85ee05e8b1c507feed018703bb17bca087ec8

improve documentation

ssrijs committed 5 years ago
Unverified
d97c78d80c366bd1223d4e8297183361585376c1

cargo fmt

ssrijs committed 5 years ago
Verified
8e02f692cf9d9d9ec6f25fec042d304e7b1c5899

add section about fuzzing

ssrijs committed 5 years ago
Unverified
2ee39b6fc1946018d9275aecc5888494da6740de

add fuzzing targets for avx2 and sse42

ssrijs committed 5 years ago
Unverified
5e4a54a176aa52cbf6353781ee79ffaff4b7a1a3

fix example in readme

ssrijs committed 5 years ago

README

The README file for this repository.

gearhash

The GEAR hashing function is a fast, rolling hash function that is well suited for content defined chunking.

In particular, this function is used as a building block for the FastCDC algorithm.

The implementation provided in this crate consists of both a simple, scalar variant, as well as optimized versions for the SSE4.2 and AVX2 instruction sets.

Usage

use gearhash::Hasher;

// set up initial state
let mut chunks = vec![];
let mut offset = 0;

// create new hasher
let mut hasher = Hasher::default();

// loop through all matches, and push the corresponding chunks
while let Some(boundary) = hasher.next_match(&buf[offset..], MASK) {
    chunks.push(&buf[offset..offset + boundary]);
    offset += boundary;
}

// push final chunk
chunks.push(&buf[offset..]);

Fuzzing

To ensure memory safety of the unsafe SIMD code in this crate, we use cargo-fuzz.

You can find the fuzzing targets under fuzz/fuzz_targets, which can be run using cargo fuzz run <target>.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.