{"_id":"@taceo/poseidon2","_rev":"2-901ad1faa2878f58fa8e04413e68791f","name":"@taceo/poseidon2","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@taceo/poseidon2","version":"0.2.0","keywords":["poseidon2","bn254","hash","zk","cryptography","sponge"],"license":"MIT","_id":"@taceo/poseidon2@0.2.0","maintainers":[{"name":"fgruber","email":"gruber@taceo.io"},{"name":"dkales","email":"kales@taceo.io"}],"homepage":"https://github.com/TaceoLabs/oprf-client-js#readme","bugs":{"url":"https://github.com/TaceoLabs/oprf-client-js/issues"},"dist":{"shasum":"5cb5e1c585d1c37550e95cd96da046e3187b3ea3","tarball":"https://registry.npmjs.org/@taceo/poseidon2/-/poseidon2-0.2.0.tgz","fileCount":9,"integrity":"sha512-+EyFO7zaRrlsdzNEvzTLELDkrgjUgZgSlxGUSQghmmtlZ14nZklYX7D+gecyOkVe/47AGDtA+uZ9sdXiNB8rng==","signatures":[{"sig":"MEUCIQD80dn1mrSoJFJiP+b2t91DgjOLGvMfB+vAuGqZYeMZNwIgGavmmMjB3PiwCAoGvXiR1OoD8FCNbqQjGhe/BBqi9A0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":346238},"main":"./dist/index.cjs","type":"module","_from":"file:taceo-poseidon2-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"lint":"eslint src test","test":"vitest run","build":"tsup","test:watch":"vitest"},"_npmUser":{"name":"dkales","email":"kales@taceo.io"},"_resolved":"/tmp/936be314010df0aff91bb857a88886b8/taceo-poseidon2-0.2.0.tgz","_integrity":"sha512-+EyFO7zaRrlsdzNEvzTLELDkrgjUgZgSlxGUSQghmmtlZ14nZklYX7D+gecyOkVe/47AGDtA+uZ9sdXiNB8rng==","repository":{"url":"git+https://github.com/TaceoLabs/oprf-client-js.git","type":"git","directory":"packages/poseidon2"},"_npmVersion":"11.5.1","description":"Poseidon2 hash function over the BN254 scalar field (state sizes t=2,3,4,8,12,16)","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@noble/curves":"^2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^4.0.18","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/poseidon2_0.2.0_1773066845610_0.6298931476954039","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-03-09T14:34:05.492Z","modified":"2026-07-23T09:35:24.123Z","0.2.0":"2026-03-09T14:34:05.813Z"},"bugs":{"url":"https://github.com/TaceoLabs/oprf-client-js/issues"},"license":"MIT","homepage":"https://github.com/TaceoLabs/oprf-client-js#readme","keywords":["poseidon2","bn254","hash","zk","cryptography","sponge"],"repository":{"url":"git+https://github.com/TaceoLabs/oprf-client-js.git","type":"git","directory":"packages/poseidon2"},"description":"Poseidon2 hash function over the BN254 scalar field (state sizes t=2,3,4,8,12,16)","maintainers":[{"email":"gruber@taceo.io","name":"fgruber"},{"email":"kales@taceo.io","name":"dkales"},{"email":"nieddu@taceo.io","name":"0xthemis"}],"readme":"# @taceo/poseidon2\n\nPoseidon2 permutation for the BN254 scalar field, with **parity** to the Rust [taceo-poseidon2](https://github.com/TaceoLabs/poseidon2) crate.\n\nBased on [Poseidon2 (eprint.iacr.org/2023/323)](https://eprint.iacr.org/2023/323). Parameters are compatible with the [HorizenLabs parameter script](https://github.com/HorizenLabs/poseidon2/blob/main/poseidon2_rust_params.sage).\n\n## Installation\n\n```bash\npnpm add @taceo/poseidon2\n```\n\n## Usage\n\n```ts\nimport { bn254 } from '@taceo/poseidon2';\n\n// State sizes t=2, t=3, t=4, t=8, t=12, t=16\nconst state = [0n, 1n, 2n, 3n];\nconst out = bn254.t4.permutation(state); // returns new array\nbn254.t4.permutationInPlace(state); // mutates in place\n```\n\nField elements are BN254 scalar field elements (`bigint` in the range `[0, p)`), we use `@noble/curves`’s `bn254_Fr` internally.\n\n## API\n\n- **`bn254.t2` … `bn254.t16`** — permutation for state size 2, 3, 4, 8, 12, 16\n  - **`permutation(state: readonly bigint[]): bigint[]`** — returns new state\n  - **`permutationInPlace(state: bigint[]): void`** — mutates state\n\n## License\n\nMIT or Apache 2.0\n","readmeFilename":"README.md"}