{"id":20771312,"url":"https://github.com/printfn/extendhash","last_synced_at":"2025-07-25T20:38:13.453Z","repository":{"id":57626934,"uuid":"237529441","full_name":"printfn/extendhash","owner":"printfn","description":"Rust Hash Extender (for MD5, SHA-1, SHA-256, SHA-512 and more)","archived":false,"fork":false,"pushed_at":"2022-11-12T06:46:35.000Z","size":350,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T14:26:03.224Z","etag":null,"topics":["hacktoberfest","hash","hash-algorithms","hash-extensions","length-extension","rust","sha1","sha256"],"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/printfn.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}},"created_at":"2020-01-31T22:48:33.000Z","updated_at":"2022-09-17T10:47:21.000Z","dependencies_parsed_at":"2023-01-22T02:00:50.931Z","dependency_job_id":null,"html_url":"https://github.com/printfn/extendhash","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printfn%2Fextendhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printfn%2Fextendhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printfn%2Fextendhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/printfn%2Fextendhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/printfn","download_url":"https://codeload.github.com/printfn/extendhash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251720992,"owners_count":21632751,"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":["hacktoberfest","hash","hash-algorithms","hash-extensions","length-extension","rust","sha1","sha256"],"created_at":"2024-11-17T12:14:28.586Z","updated_at":"2025-04-30T14:26:18.306Z","avatar_url":"https://github.com/printfn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# extendhash\n\n[![crates.io](https://img.shields.io/crates/v/extendhash.svg)](https://crates.io/crates/extendhash)\n[![docs.rs](https://docs.rs/extendhash/badge.svg)](https://docs.rs/extendhash)\n\n**extendhash** is a Rust library to compute hashes and hash extensions.\n\nSupported hash algorithms:\n\n  * MD5\n  * SHA-0\n  * SHA-1\n  * SHA-256\n  * SHA-512\n\nIt supports `#![no_std]`. All hash algorithms and hash extensions are\nimplemented in constant functions (using `const fn`) and can therefore\nbe used in constant values.\n\n## Usage\n\n```rust\nuse extendhash::sha256;\n\nlet secret_data = \"This is a secret!\".as_bytes();\nlet hash = sha256::compute_hash(secret_data);\nlet data_length = secret_data.len();\n\n// Now we try computing a hash extension,\n// assuming that `secret_data` is not available.\n// We only need `hash` and `data_length`.\nlet appended_message = \"Appended message.\".as_bytes();\nlet combined_hash = sha256::extend_hash(\n\thash, data_length, appended_message);\n\n// Now we verify that `combined_hash` matches the\n// concatenation (note the intermediate padding):\nlet mut combined_data = Vec::\u003cu8\u003e::new();\ncombined_data.extend_from_slice(secret_data);\nlet padding = sha256::padding_for_length(data_length);\ncombined_data.extend_from_slice(padding.as_slice());\ncombined_data.extend_from_slice(appended_message);\nassert_eq!(\n\tcombined_hash,\n\tsha256::compute_hash(combined_data.as_slice()));\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the\nApache-2.0 license, shall be dual licensed as above,\nwithout any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprintfn%2Fextendhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprintfn%2Fextendhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprintfn%2Fextendhash/lists"}