Skip to content

Commit

Permalink
Merge pull request #257 from privacy-scaling-explorations/fix/secret-…
Browse files Browse the repository at this point in the history
…scalar

Add mod reduction in secret scalar generation
  • Loading branch information
cedoor authored Apr 23, 2024
2 parents 5ef9e74 + a8c6d3d commit 82a90f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/eddsa-poseidon/src/eddsa-poseidon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function deriveSecretScalar(privateKey: Buffer | Uint8Array | string): bi
hash = hash.slice(0, 32)
hash = pruneBuffer(hash)

return scalar.shiftRight(leBufferToBigInt(hash), BigInt(3))
return scalar.shiftRight(leBufferToBigInt(hash), BigInt(3)) % subOrder
}

/**
Expand Down

0 comments on commit 82a90f5

Please sign in to comment.