{"id":15611596,"url":"https://github.com/boxdot/chm-hash-rs","last_synced_at":"2025-03-29T14:45:39.152Z","repository":{"id":78593630,"uuid":"165292085","full_name":"boxdot/chm-hash-rs","owner":"boxdot","description":"CHM algorithm for generating perfect hash functions","archived":false,"fork":false,"pushed_at":"2019-01-11T18:40:22.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T15:48:40.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/boxdot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2019-01-11T18:39:16.000Z","updated_at":"2019-01-11T18:41:21.000Z","dependencies_parsed_at":"2023-03-24T06:34:17.530Z","dependency_job_id":null,"html_url":"https://github.com/boxdot/chm-hash-rs","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"dc811560f4267bbc94fa0a823974a056d38ee0b2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxdot%2Fchm-hash-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxdot%2Fchm-hash-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxdot%2Fchm-hash-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxdot%2Fchm-hash-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxdot","download_url":"https://codeload.github.com/boxdot/chm-hash-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246200297,"owners_count":20739563,"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-10-03T06:05:40.946Z","updated_at":"2025-03-29T14:45:39.130Z","avatar_url":"https://github.com/boxdot.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chm-hash\n\nPerfect hash function generator based on the CHM algorithm by Z. J. Czech, G. Havas and B.S. Majewski \"_An optimal algorithm for generating minimal perfect hash functions_\" in Information Processing Letters, 43(5):257-264, 1992.\n\n## Usage\n\n```rust\nlet animals = [\"Elephant\", \"Horse\", \"Camel\", \"Python\", \"Dog\", \"Cat\"];\nlet h = generate_hash(\n    animals\n        .iter()\n        .enumerate()\n        .map(|(idx, animal)| (animal, idx)), // idx is desired hash value\n);\nassert!(animals\n    .iter()\n    .enumerate()\n    .all(|(idx, animal)| h.hash(animal) == idx));\n```\n\n## WIP\n\nIn the above example, you don't want to use the generated version of the hash function dynamically,\nbut implement it as a static function (cf. [benches/state_lookup.rs](benches/state_lookup.rs)) due\nto performance reasons. Just run the benchmarks, you will see why.\n\n* [ ] Provide code generation e.g. by derive macro.\n* [ ] Allow to specify seed when generating the hash function, for making tests and benchmarks\n  deterministic.\n\n## Acknowledgments\n\nMost of the code is ported from http://ilan.schnell-web.net/prog/perfect-hash/.\n\n## License\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT License ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this document by you, as defined in the Apache-2.0 license,\nshall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxdot%2Fchm-hash-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxdot%2Fchm-hash-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxdot%2Fchm-hash-rs/lists"}