privacy-scaling-explorations / zk-kit

A monorepo of reusable libraries for zero-knowledge technologies.
https://zkkit.pse.dev
MIT License
295 stars 80 forks source link

Private key can be out of range #239

Closed 0xbok closed 7 months ago

0xbok commented 7 months ago

so l is of 251 bits (as used in eip-2494) (r in geometry's report; to be linked). The right shift by 3 bits make the private key outside this range.

https://github.com/privacy-scaling-explorations/zk-kit/blob/ce826a9f754d8efa39993647f066dbec1d2b5093/packages/eddsa-poseidon/src/eddsa-poseidon.ts#L56

Proposed fixe (after internal discussion with @gubsheep and semaphore team):

ignore below (keeping here for history): Previous proposed fix: