{"id":13531443,"url":"https://github.com/dusk-network/poseidon252","last_synced_at":"2025-12-29T23:25:51.973Z","repository":{"id":34998392,"uuid":"237962641","full_name":"dusk-network/Poseidon252","owner":"dusk-network","description":"Reference implementation for the Poseidon Snark-friendly Hash algorithm. ","archived":false,"fork":false,"pushed_at":"2025-02-06T15:52:52.000Z","size":1491,"stargazers_count":212,"open_issues_count":1,"forks_count":38,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T04:11:54.372Z","etag":null,"topics":["hash","merkle-tree-proof","plonk-circuits","poseidon","poseidon-hashes","zk-circuits"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dusk-network.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2020-02-03T12:43:35.000Z","updated_at":"2025-03-28T01:47:45.000Z","dependencies_parsed_at":"2023-12-13T13:46:38.934Z","dependency_job_id":"f71c7fa9-da87-4f03-be62-6096f5af1369","html_url":"https://github.com/dusk-network/Poseidon252","commit_stats":{"total_commits":312,"total_committers":9,"mean_commits":"34.666666666666664","dds":0.5865384615384616,"last_synced_commit":"7718e9d21c008ee84ea757757d0e47afdd0e32f9"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusk-network%2FPoseidon252","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusk-network%2FPoseidon252/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusk-network%2FPoseidon252/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dusk-network%2FPoseidon252/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dusk-network","download_url":"https://codeload.github.com/dusk-network/Poseidon252/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246700605,"owners_count":20819901,"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":["hash","merkle-tree-proof","plonk-circuits","poseidon","poseidon-hashes","zk-circuits"],"created_at":"2024-08-01T07:01:03.042Z","updated_at":"2025-12-29T23:25:51.947Z","avatar_url":"https://github.com/dusk-network.png","language":"Rust","funding_links":[],"categories":["Cryptography"],"sub_categories":["Hash Function"],"readme":"![Build Status](https://github.com/dusk-network/Poseidon252/workflows/Continuous%20integration/badge.svg)\n[![Repository](https://img.shields.io/badge/github-poseidon252-blueviolet)](https://github.com/dusk-network/Poseidon252)\n[![Documentation](https://img.shields.io/badge/docs-poseidon252-blue)](https://docs.rs/dusk-poseidon/latest/dusk_poseidon/)\n\n# Dusk-Poseidon\n\nReference implementation for the Poseidon Hashing algorithm.\n\nReference:\n[Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof Systems](https://eprint.iacr.org/2019/458.pdf)\n\nThis repository has been created so there's a unique library that holds the tools \u0026 functions required to perform Poseidon Hashes on field elements of the bls12-381 elliptic curve.\n\nThe hash uses the Hades design for its inner permutation and the [SAFE](https://eprint.iacr.org/2023/522.pdf) framework for contstructing the sponge.\n\nThe library provides the two hashing techniques of Poseidon:\n- The 'normal' hashing functionalities operating on `BlsScalar`.\n- The 'gadget' hashing functionalities that build a circuit which outputs the hash.\n\n## Example\n\n```rust\nuse rand::rngs::StdRng;\nuse rand::SeedableRng;\n\nuse dusk_poseidon::{Domain, Hash};\nuse dusk_bls12_381::BlsScalar;\nuse ff::Field;\n\n// generate random input\nlet mut rng = StdRng::seed_from_u64(0xbeef);\nlet mut input = [BlsScalar::zero(); 42];\nfor scalar in input.iter_mut() {\n    *scalar = BlsScalar::random(\u0026mut rng);\n}\n\n// digest the input all at once\nlet hash = Hash::digest(Domain::Other, \u0026input);\n\n// update the input gradually\nlet mut hasher = Hash::new(Domain::Other);\nhasher.update(\u0026input[..3]);\nhasher.update(\u0026input[3..]);\nassert_eq!(hash, hasher.finalize());\n\n// create a hash used for merkle tree hashing with arity = 4\nlet merkle_hash = Hash::digest(Domain::Merkle4, \u0026input[..4]);\n\n// which is different when another domain is used\nassert_ne!(merkle_hash, Hash::digest(Domain::Other, \u0026input[..4]));\n```\n\n## Benchmarks\n\nThere are benchmarks for hashing, encrypting and decrypting in their native form, operating on `Scalar`, and for a zero-knowledge circuit proof generation and verification.\n\nTo run all benchmarks on your machine, run\n```shell\ncargo bench --features=zk,encryption\n```\nin the repository.\n\n## Licensing\n\nThis code is licensed under Mozilla Public License Version 2.0 (MPL-2.0). Please see [LICENSE](https://github.com/dusk-network/plonk/blob/master/LICENSE) for further info.\n\n## About\n\nImplementation designed by the [dusk](https://dusk.network) team.\n\n## Contributing\n\n- If you want to contribute to this repository/project please, check [CONTRIBUTING.md](https://github.com/dusk-network/Poseidon252/blob/master/CONTRIBUTING.md)\n- If you want to report a bug or request a new feature addition, please open an issue on this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusk-network%2Fposeidon252","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdusk-network%2Fposeidon252","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdusk-network%2Fposeidon252/lists"}