{"id":13995154,"url":"https://github.com/flier/rust-fasthash","last_synced_at":"2025-04-05T00:07:19.644Z","repository":{"id":47493221,"uuid":"77193749","full_name":"flier/rust-fasthash","owner":"flier","description":"A suite of non-cryptographic hash functions for Rust.","archived":false,"fork":false,"pushed_at":"2022-04-17T08:07:10.000Z","size":1489,"stargazers_count":135,"open_issues_count":12,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-13T20:49:33.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-23T03:13:07.000Z","updated_at":"2024-08-21T23:19:44.000Z","dependencies_parsed_at":"2022-08-03T08:00:45.685Z","dependency_job_id":null,"html_url":"https://github.com/flier/rust-fasthash","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-fasthash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-fasthash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-fasthash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-fasthash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flier","download_url":"https://codeload.github.com/flier/rust-fasthash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T14:03:16.642Z","updated_at":"2025-04-05T00:07:19.621Z","avatar_url":"https://github.com/flier.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"## rust-fasthash [![Continuous integration](https://github.com/flier/rust-fasthash/actions/workflows/ci.yml/badge.svg)](https://github.com/flier/rust-fasthash/actions/workflows/ci.yml) [![crate](https://img.shields.io/crates/v/fasthash.svg)](https://crates.io/crates/fasthash) [![docs](https://docs.rs/fasthash/badge.svg)](https://docs.rs/crate/fasthash/)\nA suite of non-cryptographic hash functions for Rust, binding the [smhasher](https://github.com/rurban/smhasher/).\n\n## Usage\n\n```toml\n[dependencies]\nfasthash = \"0.4\"\n```\n\n### `hash` and `hash_with_seed` function\n\n```rust\nuse fasthash::*;\n\nlet h = city::hash64(\"hello world\");\n\nlet h = metro::hash64_with_seed(\"hello world\", 123);\n```\n\n### `std::hash::Hash`\n\n```rust\nuse std::hash::{Hash, Hasher};\n\nuse fasthash::{MetroHasher, FastHasher};\n\nfn hash\u003cT: Hash\u003e(t: \u0026T) -\u003e u64 {\n    // Or use any of the `*Hasher` struct's available as aliases from\n    // root or in their respective modules as Hasher32/64 and some 128.\n    let mut s = MetroHasher::default();\n    t.hash(\u0026mut s);\n    s.finish()\n}\n\nhash(\u0026\"hello world\");\n```\n\n### `HashMap` and `HashSet`\n\n```rust\nuse std::collections::HashSet;\n\nuse fasthash::spooky::Hash128;\n\nlet mut set = HashSet::with_hasher(Hash128);\n\nset.insert(2);\n```\n\n### `RandomState`\n\n```rust\nuse std::collections::HashMap;\n\nuse fasthash::RandomState;\nuse fasthash::city::Hash64;\n\nlet s = RandomState::\u003cHash64\u003e::new();\nlet mut map = HashMap::with_hasher(s);\n\nassert_eq!(map.insert(37, \"a\"), None);\nassert_eq!(map.is_empty(), false);\n\nmap.insert(37, \"b\");\nassert_eq!(map.insert(37, \"c\"), Some(\"b\"));\nassert_eq!(map[\u002637], \"c\");\n```\n\n## Hash Functions\n\n\n\n- Modern Hash Functions\n  - [City Hash](https://github.com/google/cityhash)\n  - [Farm Hash](https://github.com/google/farmhash)\n  - [Highway Hash](https://github.com/google/highwayhash)\n  - [Komi Hash](https://github.com/avaneev/komihash) **new**\n  - [Lookup3](https://en.wikipedia.org/wiki/Jenkins_hash_function)\n  - [Meow Hash](https://github.com/cmuratori/meow_hash) **new**\n  - [Metro Hash](https://github.com/jandrewrogers/MetroHash)\n  - [Mum Hash](https://github.com/vnmakarov/mum-hash)\n  - [Murmur Hash](https://sites.google.com/site/murmurhash/)\n  - [mx3 Hash](https://github.com/jonmaiga/mx3) **new**\n  - [NmHash](https://github.com/gzm55/hash-garage) **new**\n  - [PengyHash](https://github.com/tinypeng/pengyhash) **new**\n  - [PrvHash](https://github.com/avaneev/prvhash) **new**\n  - [Sea Hash](https://github.com/ticki/tfs/tree/master/seahash)\n  - [Spooky Hash](http://burtleburtle.net/bob/hash/spooky.html)\n  - [T1ha Hash](https://github.com/leo-yuriev/t1ha)\n  - [Umash](https://github.com/backtrace-labs/umash) **new**\n  - [wyhash](https://github.com/wangyi-fudan/wyhash) (final3)\n  - [xx Hash](https://github.com/Cyan4973/xxHash) with  **experimental** [XXH3](https://github.com/Cyan4973/xxHash#new-experimental-hash-algorithm) hash algorithm\n- Compatibility\n  - [Hasher](https://doc.rust-lang.org/std/hash/trait.Hasher.html)\n  - std::collections::{[HashMap](https://doc.rust-lang.org/std/collections/struct.HashMap.html), [HashSet](https://doc.rust-lang.org/std/collections/struct.HashSet.html)} with `RandomState`\n  - [Digest](https://docs.rs/digest/0.8.1/digest/trait.Digest.html) (optional)\n\n## Benchmark\n\nFirst install cargo-criterion:\n\n```bash\n$ cargo install cargo-criterion\n```\n\nThen you can use it to run `Criterion-rs` benchmarks:\n\n```bash\n$ cargo criterion\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Frust-fasthash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflier%2Frust-fasthash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Frust-fasthash/lists"}