Skip to content

euceph/adler32-simd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adler32-simd

SIMD-accelerated Adler-32 checksum for Rust.

Vectorized implementations for ARM64 NEON and x86/x86_64 SSSE3, with an automatic scalar fallback on other platforms. Zero dependencies and no_std compatible.

Usage

Add to Cargo.toml:

[dependencies]
adler32-simd = "0.1"

One-shot:

let checksum = adler32_simd::adler32(b"Hello, world!");

Streaming:

let mut hasher = adler32_simd::Adler32::new();
hasher.write(b"Hello, ");
hasher.write(b"world!");
let checksum = hasher.checksum();

Adler32 also implements std::hash::Hasher (with the default std feature):

use std::hash::Hasher;

let mut hasher = adler32_simd::Adler32::new();
hasher.write(b"data");
let checksum = hasher.finish(); // returns u64

Features

Feature Default Description
std Yes Enables runtime CPU feature detection and Hasher impl. Disable for no_std.

To use in a no_std environment:

[dependencies]
adler32-simd = { version = "0.1", default-features = false }

When std is disabled, SIMD is used only if the target feature is enabled at compile time (e.g. -C target-feature=+neon). Otherwise the scalar fallback is used.

Platform support

Architecture Instruction set Detection
aarch64 NEON Runtime (std) / compile-time (no_std)
x86 / x86_64 SSSE3 Runtime (std) / compile-time (no_std)
Everything else Scalar Automatic fallback

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages