{"id":30830645,"url":"https://github.com/psyprotocol/poseidon2","last_synced_at":"2025-09-06T15:56:41.810Z","repository":{"id":174197616,"uuid":"651885047","full_name":"PsyProtocol/poseidon2","owner":"PsyProtocol","description":"TypeScript Implementation of the Poseidon2 Hash Function (3kb 🎉)","archived":false,"fork":false,"pushed_at":"2024-03-04T15:27:50.000Z","size":134,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-20T21:04:29.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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.md","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-06-10T11:43:30.000Z","updated_at":"2025-05-15T10:22:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8a7532b-6b69-4bc9-b385-bddc6423d30e","html_url":"https://github.com/PsyProtocol/poseidon2","commit_stats":null,"previous_names":["openassetstandards/poseidon2","psyprotocol/poseidon2"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/PsyProtocol/poseidon2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PsyProtocol","download_url":"https://codeload.github.com/PsyProtocol/poseidon2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PsyProtocol%2Fposeidon2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273926539,"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:36.850Z","updated_at":"2025-09-06T15:56:41.798Z","avatar_url":"https://github.com/PsyProtocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\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\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eposeidon2\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\nA zero dependency implementation of the \u003ca href=\"https://eprint.iacr.org/2023/323.pdf\"\u003ePoseidon2\u003c/a\u003e hash function.\nThe permutation function exposed by the Poseidon2 class is one-to-one compatible with \u003ca href=\"https://github.com/HorizenLabs/poseidon2/blob/main/plain_implementations/src/poseidon2/poseidon2.rs\"\u003eHorizenLabs/poseidon2\u003c/a\u003e. 3kb gzipped 🎉\n  \u003c/p\u003e\n\u003c/div\u003e\n\n# Install\n\n```bash\nnpm install poseidon2\n```\n\n#### Note For TypeScript Users:\n\nIf you see the error \"Cannot find module 'poseidon2/goldilocks-12' or its corresponding type declarations.ts(2307)\", update your tsconfig.json to set \"moduleResolution\": \"NodeNext\".\n\n## Usage For Goldilocks Field, T = 12\n\n### Permute\n\n```javascript\nimport { permute } from \"poseidon2/goldilocks-12\";\nconst result = permute([\n  1337n,\n  123456n,\n  100n,\n  15n,\n  1n,\n  2n,\n  3n,\n  4n,\n  22n,\n  23n,\n  24n,\n  25n,\n]);\n```\n\n### Two to One (Hash two 4-element-wide values)\n\n```javascript\nimport { twoToOne } from \"poseidon2/goldilocks-12\";\nconst result = twoToOne([1337n, 123456n, 100n, 15n], [1n, 2n, 3n, 4n]);\n```\n\n### Sponge Hash with Pad (Hash n elements with padding)\n\n```javascript\nimport { hashPad } from \"poseidon2/goldilocks-12\";\nconst result = hashPad([1n, 2n, 3n, 1337n, 9999n, 123n]);\n```\n\n## How to use with other prime fields/t values\n\nSee [Working with other prime fields and t values](./CUSTOM_FIELD_T.md).\n\n## Credits\n\nOriginal implementation of poseidon2 by https://github.com/HorizenLabs\n\n# License\n\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\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n\n[contributors-shield]: https://img.shields.io/github/contributors/OpenAssetStandards/poseidon2.svg?style=for-the-badge\n[contributors-url]: https://github.com/OpenAssetStandards/poseidon2/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/OpenAssetStandards/poseidon2.svg?style=for-the-badge\n[forks-url]: https://github.com/OpenAssetStandards/poseidon2/network/members\n[stars-shield]: https://img.shields.io/github/stars/OpenAssetStandards/poseidon2.svg?style=for-the-badge\n[stars-url]: https://github.com/OpenAssetStandards/poseidon2/stargazers\n[issues-shield]: https://img.shields.io/github/issues/OpenAssetStandards/poseidon2.svg?style=for-the-badge\n[issues-url]: https://github.com/OpenAssetStandards/poseidon2/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyprotocol%2Fposeidon2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsyprotocol%2Fposeidon2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsyprotocol%2Fposeidon2/lists"}