{"id":30830650,"url":"https://github.com/psyprotocol/poseidon-goldilocks","last_synced_at":"2025-09-06T15:56:44.108Z","repository":{"id":142258555,"uuid":"612784739","full_name":"PsyProtocol/poseidon-goldilocks","owner":"PsyProtocol","description":"Poseidon Hash for Goldilocks Field with Expanded Functionality","archived":false,"fork":false,"pushed_at":"2023-04-18T14:50:53.000Z","size":402,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T21:04:29.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/PsyProtocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null}},"created_at":"2023-03-12T00:42:50.000Z","updated_at":"2025-05-15T10:21:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"881e4f17-e909-4562-a029-3fb4783749ef","html_url":"https://github.com/PsyProtocol/poseidon-goldilocks","commit_stats":null,"previous_names":["psyprotocol/poseidon-goldilocks"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/PsyProtocol/poseidon-goldilocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon-goldilocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon-goldilocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon-goldilocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon-goldilocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PsyProtocol","download_url":"https://codeload.github.com/PsyProtocol/poseidon-goldilocks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon-goldilocks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273926538,"owners_count":25192318,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-06T15:56:37.684Z","updated_at":"2025-09-06T15:56:44.092Z","avatar_url":"https://github.com/PsyProtocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Improved compatibility of back to top link: See: https://github.com/OpenAssetStandards/poseidon-goldilocks/pull/73 --\u003e\n\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n\n\n\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/OpenAssetStandards/poseidon-goldilocks\"\u003e\n  \u003cimg width=\"256\" height=\"256\" src=\"https://github.com/OpenAssetStandards/poseidon-goldilocks/raw/main/docs/images/goldilocks.jpg?raw=true\"\u003e\n  \u003c/a\u003e\n\n  \u003ch3 align=\"center\"\u003eposeidon-goldilocks\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\nA full suite of Poseidon Goldilocks hash functions that are one-to-one compatible with those used in \u003ca href=\"https://github.com/mir-protocol/plonky2\"\u003eplonky2\u003c/a\u003e, along with commonly used functions for creating and verifying merkle proofs compatible with plonky2.\n  \u003c/p\u003e\n\u003c/div\u003e\n\nCredit to the original Mir team for creating plonky2. \nConstants for poseidon goldilocks were generated using [hadeshash](https://extgit.iaik.tugraz.at/krypto/hadeshash).\n\n\n# Usage:\n### Two to One (Hash two 4-element-wide values)\n```javascript\nimport {twoToOne} from 'poseidon-goldilocks';\nconst c = twoToOne([1337n, 123456n, 100n, 15n], [1n, 2n, 3n, 4n]);\n```\n\u003cdetails\u003e\u003csummary\u003ePlonky2 Equivalent\u003c/summary\u003e\n\n\u003cp\u003e\n\n\n\n```rust\ntype F = GoldilocksField;\nlet a = HashOut { elements: [\n  F::from_noncanonical_u64(1337),\n  F::from_noncanonical_u64(123456),\n  F::from_noncanonical_u64(100),\n  F::from_noncanonical_u64(15),\n] };\nlet b = HashOut { elements: [\n  F::from_noncanonical_u64(1),\n  F::from_noncanonical_u64(2),\n  F::from_noncanonical_u64(3),\n  F::from_noncanonical_u64(4),\n] };\nlet c = PoseidonHash::two_to_one(a, b);\n```\n\n\u003c/p\u003e\n\n\u003c/details\u003e\n\n### Sponge Hash with Pad (Hash n elements with padding)\n```javascript\nimport {hashPad} from 'poseidon-goldilocks';\nconst result = hashPad([1n, 2n, 3n, 1337n, 9999n, 123n]);\n```\n\u003cdetails\u003e\u003csummary\u003ePlonky2 Equivalent\u003c/summary\u003e\n\n\u003cp\u003e\n\n\n\n```rust\ntype F = GoldilocksField;\nlet result = PoseidonHash::hash_pad(\u0026[\n  F::from_noncanonical_u64(1),\n  F::from_noncanonical_u64(2),\n  F::from_noncanonical_u64(3),\n  F::from_noncanonical_u64(1337),\n  F::from_noncanonical_u64(9999),\n  F::from_noncanonical_u64(123),\n]);\n```\n\n\u003c/p\u003e\n\n\u003c/details\u003e\n\n\n## Todo\n* Complete rest of documentation\n\n# License\nMIT License\n\nCopyright (c) 2023 Zero Knowledge Labs Limited\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[contributors-shield]: https://img.shields.io/github/contributors/OpenAssetStandards/poseidon-goldilocks.svg?style=for-the-badge\n[contributors-url]: https://github.com/OpenAssetStandards/poseidon-goldilocks/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/OpenAssetStandards/poseidon-goldilocks.svg?style=for-the-badge\n[forks-url]: https://github.com/OpenAssetStandards/poseidon-goldilocks/network/members\n[stars-shield]: https://img.shields.io/github/stars/OpenAssetStandards/poseidon-goldilocks.svg?style=for-the-badge\n[stars-url]: https://github.com/OpenAssetStandards/poseidon-goldilocks/stargazers\n[issues-shield]: https://img.shields.io/github/issues/OpenAssetStandards/poseidon-goldilocks.svg?style=for-the-badge\n[issues-url]: https://github.com/OpenAssetStandards/poseidon-goldilocks/issues","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyprotocol%2Fposeidon-goldilocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsyprotocol%2Fposeidon-goldilocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyprotocol%2Fposeidon-goldilocks/lists"}