2 个版本

0.1.1 2024年5月6日
0.1.0 2023年8月22日

#1010算法

Download history • Rust 包仓库 357/week @ 2024-04-20 • Rust 包仓库 343/week @ 2024-04-27 • Rust 包仓库 538/week @ 2024-05-04 • Rust 包仓库 221/week @ 2024-05-11 • Rust 包仓库 235/week @ 2024-05-18 • Rust 包仓库 150/week @ 2024-05-25 • Rust 包仓库 425/week @ 2024-06-01 • Rust 包仓库 261/week @ 2024-06-08 • Rust 包仓库 132/week @ 2024-06-15 • Rust 包仓库 88/week @ 2024-06-22 • Rust 包仓库 92/week @ 2024-06-29 • Rust 包仓库 143/week @ 2024-07-06 • Rust 包仓库 130/week @ 2024-07-13 • Rust 包仓库 175/week @ 2024-07-20 • Rust 包仓库 299/week @ 2024-07-27 • Rust 包仓库 164/week @ 2024-08-03 • Rust 包仓库

801 每月下载量
用于 4 个包 (通过 malwaredb-lzjd)

MIT 许可证

13KB
302

TestLintCrates.io Version

MurmurHash3.rs

A rust implementation of the MurmurHash3 algorithm. Both 32 bit and 128 bit versions are included. The 128 bit version is implemented with 64 bit datatypes, making it most suitable for x86_64 or other 64 bit architectures.

This is a minor change from the upstream version. Modifications here remove dependencies on crates which prevented compilation on non-x86 hardware, and updated to Rust edition 2021.

用法

在你的 Cargo.toml

[dependencies]
malwaredb-murmurhash3 = "0.1"

然后你可以开始使用 murmurhash3_x86_32murmurhash3_x64_128

use malwaredb_murmurhash3::murmurhash3_x64_128;

fn hash_value() {
    let data = "test data";
    let seed = 48221234;

    let hash = murmurhash3_x64_128(data.as_bytes(), seed);
}

不幸的是,HashState 库实现中存在一个错误,这阻止了新的 Hasher 实现的实施,用于例如 HashMap。此外,由于 HashMap 在内部使用 64 位哈希,因此只能使用 32 位哈希器。

测试

运行 cargo test

无运行时依赖