{"id":15956105,"url":"https://github.com/jsign/sumhash","last_synced_at":"2025-03-18T00:30:29.517Z","repository":{"id":54216404,"uuid":"522084182","full_name":"jsign/sumhash","owner":"jsign","description":"sumhash512 cryptographic function implementation","archived":false,"fork":false,"pushed_at":"2023-05-29T05:02:22.000Z","size":64,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T05:56:03.320Z","etag":null,"topics":["algorand","cryptography","hash","rust"],"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/jsign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-08-07T00:39:24.000Z","updated_at":"2023-07-28T06:59:16.000Z","dependencies_parsed_at":"2024-10-27T16:54:33.382Z","dependency_job_id":"56dce049-3107-4bfb-bd59-8952363ea524","html_url":"https://github.com/jsign/sumhash","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsign%2Fsumhash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsign%2Fsumhash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsign%2Fsumhash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsign%2Fsumhash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsign","download_url":"https://codeload.github.com/jsign/sumhash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893543,"owners_count":20364914,"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":["algorand","cryptography","hash","rust"],"created_at":"2024-10-07T13:28:28.069Z","updated_at":"2025-03-18T00:30:29.227Z","avatar_url":"https://github.com/jsign.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sumhash\n\n[![Crates.io](https://img.shields.io/crates/v/sumhash.svg)](https://crates.io/crates/sumhash)\n[![Docs.rs](https://docs.rs/sumhash/badge.svg)](https://docs.rs/sumhash)\n[![CI](https://github.com/jsign/sumhash/workflows/CI/badge.svg)](https://github.com/jsign/sumhash/actions)\n\nThis repository contains a Rust implementation of subset-sum hash function designed by the Algorand project.\n\nThe reference implementation is written in Go and can be found in the [`go-sumhash`] repository.\nYou can also refer to the [`spec`] to see a formal description of the hash function.\n\nThis implementation provides a _core_ implementation to be used with the `CoreWrapper` trait. \nIf you're interested in an earlier version that was a direct port of the reference implementation, see the `legacyport` branch.\n\nThis library has an `AlgorandSumhash512Core` type alias which facilitates a default configuration for Sumhash512Core that utilizes the official seed for the Algorand blockchain state proofs. The AlgorandSumhash512Core uses a lookup table as the default underlying compressor setup instead of a matrix.\n\nThis library **is**n't** audited, nor is it an official implementation.\n\nYou might be interested in [this article explaining more details](https://ihagopian.com/posts/implementing-algorands-sumhash512-cryptographic-hash-function-in-rust) about the implementation and performance of the library.\n\n\n[`go-sumhash`]: https://github.com/algorand/go-sumhash\n[`spec`]: https://github.com/algorand/go-sumhash/blob/master/spec/sumhash-spec.pdf\n\n## Use\n\nUsing the Algorand instance configuration:\n\n```rust\nuse sumhash::sumhash512core::AlgorandSumhash512Core;\nuse digest::{core_api::CoreWrapper, FixedOutput, Update};\n\nfn main() {\n  let mut h = CoreWrapper::\u003cAlgorandSumhash512Core\u003e::default();\n  h.update(\"hello world\".as_bytes());\n  let output = h.finalize_fixed();\n  println!(\"Result: {}\", hex::encode(\u0026output));\n}\n```\n\nGeneric flavor providing a custom seed:\n\n```rust\nuse sumhash::sumhash512core::Sumhash512Core;\nuse digest::{core_api::CoreWrapper, FixedOutput, Update};\n\nfn main() {\n  let mut salt = [0; 64];\n  salt[0] = 0x13;\n  salt[1] = 0x37;\n  let mut h = CoreWrapper::from_core(Sumhash512Core::new_with_salt(salt));\n  h.update(\"hello world\".as_bytes());\n  let output = h.finalize_fixed();\n  println!(\"Result: {}\", hex::encode(\u0026output));\n}\n```\n\n## Cargo\n\n### Build\n\nRun `cargo build`.\n\n### Tests\n\nAll the existing tests from `go-sumhash` have been ported and are passing. The tests rely on generating random matrixes using `Shake256` where this library also honors the input and expected exact output match, giving confidence for correctness.\n\nRun `cargo test`:\n\n```bash\nrunning 5 tests\ntest sumhash512core::test::sumhash512_salt ... ok\ntest sumhash512core::test::sumhash512 ... ok\ntest sumhash512core::test::sumhash512_reset ... ok\ntest sumhash512core::test::test_vector ... ok\ntest compress::test::compression ... ok\n\ntest result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.59s\n\n   Doc-tests sumhash\n\nrunning 2 tests\ntest src/lib.rs - (line 37) ... ok\ntest src/lib.rs - (line 26) ... ok\n\ntest result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.21s\n```\n\n### Benchmarks\n\nYou can run benchmarks with `cargo bench`.\n\n## License\n\nLicensed under either of [MIT license](LICENSE-MIT).\n\n## Contribution\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsign%2Fsumhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsign%2Fsumhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsign%2Fsumhash/lists"}