{"id":13580804,"url":"https://github.com/shepmaster/twox-hash","last_synced_at":"2025-05-14T03:11:08.159Z","repository":{"id":31746318,"uuid":"35312393","full_name":"shepmaster/twox-hash","owner":"shepmaster","description":"A Rust implementation of the xxHash algorithm.","archived":false,"fork":false,"pushed_at":"2024-12-09T15:57:42.000Z","size":2106,"stargazers_count":392,"open_issues_count":26,"forks_count":42,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-03T03:10:01.486Z","etag":null,"topics":["hashing","rust","xxhash"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shepmaster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"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":"2015-05-09T02:52:24.000Z","updated_at":"2025-04-25T17:53:13.000Z","dependencies_parsed_at":"2024-06-18T15:32:19.830Z","dependency_job_id":"815baa74-2a1c-4fef-9c02-61831723ddd8","html_url":"https://github.com/shepmaster/twox-hash","commit_stats":{"total_commits":318,"total_committers":15,"mean_commits":21.2,"dds":0.08176100628930816,"last_synced_commit":"725da3f7835d009d78e68170d68f1c198a4f8f9c"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Ftwox-hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Ftwox-hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Ftwox-hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepmaster%2Ftwox-hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shepmaster","download_url":"https://codeload.github.com/shepmaster/twox-hash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254049540,"owners_count":22006080,"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":["hashing","rust","xxhash"],"created_at":"2024-08-01T15:01:55.214Z","updated_at":"2025-05-14T03:11:03.150Z","avatar_url":"https://github.com/shepmaster.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"A Rust implementation of the [xxHash] algorithm.\n\n[![Crates.io][crates-badge]][crates-url]\n[![Documentation][docs-badge]][docs-url]\n[![Build Status][actions-badge]][actions-url]\n\n[xxHash]: https://github.com/Cyan4973/xxHash\n\n[crates-badge]: https://img.shields.io/crates/v/twox-hash.svg\n[crates-url]: https://crates.io/crates/twox-hash\n[docs-badge]: https://img.shields.io/docsrs/twox-hash\n[docs-url]: https://docs.rs/twox-hash/\n[actions-badge]: https://github.com/shepmaster/twox-hash/actions/workflows/ci.yml/badge.svg?branch=main\n[actions-url]: https://github.com/shepmaster/twox-hash/actions/workflows/ci.yml?query=branch%3Amain\n\n# Examples\n\nThese examples use [`XxHash64`][] but the same ideas can be\nused for [`XxHash32`][] or [`XxHash3_64`][].\n\n## Hashing arbitrary data\n\n### When all the data is available at once\n\n```rust\nuse twox_hash::XxHash64;\n\nlet seed = 1234;\nlet hash = XxHash64::oneshot(seed, b\"some bytes\");\nassert_eq!(0xeab5_5659_a496_d78b, hash);\n```\n\n### When the data is streaming\n\n```rust\nuse std::hash::Hasher as _;\nuse twox_hash::XxHash64;\n\nlet seed = 1234;\nlet mut hasher = XxHash64::with_seed(seed);\nhasher.write(b\"some\");\nhasher.write(b\" \");\nhasher.write(b\"bytes\");\nlet hash = hasher.finish();\nassert_eq!(0xeab5_5659_a496_d78b, hash);\n```\n\n## In a [`HashMap`][]\n\n### With a default seed\n\n```rust\nuse std::{collections::HashMap, hash::BuildHasherDefault};\nuse twox_hash::XxHash64;\n\nlet mut hash = HashMap::\u003c_, _, BuildHasherDefault\u003cXxHash64\u003e\u003e::default();\nhash.insert(42, \"the answer\");\nassert_eq!(hash.get(\u002642), Some(\u0026\"the answer\"));\n```\n\n### With a random seed\n\n```rust\nuse std::collections::HashMap;\nuse twox_hash::xxhash64;\n\nlet mut hash = HashMap::\u003c_, _, xxhash64::RandomState\u003e::default();\nhash.insert(42, \"the answer\");\nassert_eq!(hash.get(\u002642), Some(\u0026\"the answer\"));\n```\n\n### With a fixed seed\n\n```rust\nuse std::collections::HashMap;\nuse twox_hash::xxhash64;\n\nlet mut hash = HashMap::with_hasher(xxhash64::State::with_seed(0xdead_cafe));\nhash.insert(42, \"the answer\");\nassert_eq!(hash.get(\u002642), Some(\u0026\"the answer\"));\n```\n\n# Feature Flags\n\n| name       | description                                                                                             |\n|------------|---------------------------------------------------------------------------------------------------------|\n| xxhash32   | Include the [`XxHash32`][] algorithm                                                                    |\n| xxhash64   | Include the [`XxHash64`][] algorithm                                                                    |\n| xxhash3_64 | Include the [`XxHash3_64`][] algorithm                                                                  |\n| random     | Create random instances of the hashers                                                                  |\n| serialize  | Serialize and deserialize hasher state with Serde                                                       |\n| std        | Use the Rust standard library. Enable this if you want SIMD support in [`XxHash3_64`][]                 |\n| alloc      | Use the Rust allocator library. Enable this if you want to create [`XxHash3_64`][] with dynamic secrets |\n\n# Benchmarks\n\nSee benchmarks in the [comparison][] README.\n\n[comparison]: https://github.com/shepmaster/twox-hash/tree/main/comparison\n\n# Contributing\n\n1. Fork it (\u003chttps://github.com/shepmaster/twox-hash/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Add a failing test.\n4. Add code to pass the test.\n5. Commit your changes (`git commit -am 'Add some feature'`)\n6. Ensure tests pass.\n7. Push to the branch (`git push origin my-new-feature`)\n8. Create a new Pull Request\n\n\n[`Hashmap`]: std::collections::HashMap\n[`XxHash32`]: crate::XxHash32\n[`XxHash64`]: crate::XxHash64\n[`XxHash3_64`]: crate::XxHash3_64\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepmaster%2Ftwox-hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshepmaster%2Ftwox-hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepmaster%2Ftwox-hash/lists"}