{"id":13648534,"url":"https://github.com/rust-lang/rustc-hash","last_synced_at":"2025-05-13T21:10:25.707Z","repository":{"id":41158221,"uuid":"134712001","full_name":"rust-lang/rustc-hash","owner":"rust-lang","description":"Custom hash algorithm used by rustc (plus hashmap/set aliases): fast, deterministic, not secure","archived":false,"fork":false,"pushed_at":"2025-02-05T18:30:59.000Z","size":69,"stargazers_count":465,"open_issues_count":6,"forks_count":52,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-08T00:03:51.603Z","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/rust-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-24T12:26:21.000Z","updated_at":"2025-05-02T08:13:58.000Z","dependencies_parsed_at":"2024-01-13T15:58:26.075Z","dependency_job_id":"d413401c-38db-4fd4-89d7-21093591c6ea","html_url":"https://github.com/rust-lang/rustc-hash","commit_stats":{"total_commits":60,"total_committers":26,"mean_commits":"2.3076923076923075","dds":0.85,"last_synced_commit":"6745258da00b7251bed4a8461871522d0231a9c7"},"previous_names":["rust-lang-nursery/rustc-hash"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-lang%2Frustc-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-lang","download_url":"https://codeload.github.com/rust-lang/rustc-hash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029002,"owners_count":22002283,"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-02T01:04:19.864Z","updated_at":"2025-05-13T21:10:20.674Z","avatar_url":"https://github.com/rust-lang.png","language":"Rust","funding_links":[],"categories":["Rust","Repository"],"sub_categories":["Data structure"],"readme":"# rustc-hash\n\n[![crates.io](https://img.shields.io/crates/v/rustc-hash.svg)](https://crates.io/crates/rustc-hash)\n[![Documentation](https://docs.rs/rustc-hash/badge.svg)](https://docs.rs/rustc-hash)\n\nA speedy, non-cryptographic hashing algorithm used by `rustc`.\nThe [hash map in `std`](https://doc.rust-lang.org/std/collections/struct.HashMap.html) uses SipHash by default, which provides resistance against DOS attacks.\nThese attacks aren't a concern in the compiler so we prefer to use a quicker,\nnon-cryptographic hash algorithm.\n\nThe original hash algorithm provided by this crate was one taken from Firefox,\nhence the hasher it provides is called FxHasher. This name is kept for backwards\ncompatibility, but the underlying hash has since been replaced. The current\ndesign for the hasher is a polynomial hash finished with a single bit rotation,\ntogether with a wyhash-inspired compression function for strings/slices, both\ndesigned by Orson Peters.\n\nFor `rustc` we have tried many different hashing algorithms. Hashing speed is\ncritical, especially for single integers. Spending more CPU cycles on a higher\nquality hash does not reduce hash collisions enough to make the compiler faster\non real-world benchmarks.\n\n## Usage\n\nThis crate provides `FxHashMap` and `FxHashSet` as collections.\nThey are simply type aliases for their `std::collection` counterparts using the Fx hasher.\n\n```rust\nuse rustc_hash::FxHashMap;\n\nlet mut map: FxHashMap\u003cu32, u32\u003e = FxHashMap::default();\nmap.insert(22, 44);\n```\n\n### `no_std`\n\nThe `std` feature is on by default to enable collections.\nIt can be turned off in `Cargo.toml` like so:\n\n```toml\nrustc-hash = { version = \"2.1\", default-features = false }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Frustc-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-lang%2Frustc-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-lang%2Frustc-hash/lists"}