Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster modular reduction for Falcon signature verification #1088

Closed
Al-Kindi-0 opened this issue Oct 3, 2023 · 2 comments
Closed

Faster modular reduction for Falcon signature verification #1088

Al-Kindi-0 opened this issue Oct 3, 2023 · 2 comments
Labels
stdlib Related to Miden standard library
Milestone

Comments

@Al-Kindi-0
Copy link
Collaborator

The Falcon signature verification algorithm relies heavily on modular arithmetic with respect to the prime $12289$. The current implementation rpo_falcon512::mod_12289 is very inefficient since it uses u64_div underneath. A more optimized implementation should, in addition to using non-determinism, take into account the fact that $12289$ is less than $2^{32} - 1$.

@bobbinth
Copy link
Contributor

bobbinth commented Oct 3, 2023

One other thing to consider: would it make sense to add a native instruction which can do a modular reduction in a single VM cycle. The instruction could work like this:

Inputs:  [v, p, ...]
Outputs: [r, p, ...]

Where:

  • $v$ is the value to be reduced - could be any field element.
  • $p$ is the modulus which must be a u32 value.
  • $r = v % p$.

It probably doesn't make sense to add it solely for the purposes of Falcon signature, but if it could be used to speed up other things (e.g., ECDSA signature verification), then it might be worth it.

Also, I'm not sure how complex the constraints for this instruction would be - so, maybe not viable to begin with.

@bobbinth bobbinth added the stdlib Related to Miden standard library label Oct 4, 2023
@bobbinth bobbinth added this to the v0.8 milestone Oct 12, 2023
@bobbinth bobbinth modified the milestones: v0.8, v0.9 Feb 15, 2024
@bobbinth bobbinth modified the milestones: v0.9, v0.11.0 Jul 24, 2024
@bobbinth bobbinth modified the milestones: v0.11.0, v0.12 Aug 7, 2024
@bobbinth bobbinth modified the milestones: v0.12.0, v0.13.0 Jan 8, 2025
@Al-Kindi-0
Copy link
Collaborator Author

We have managed to improve the implementation of the Falcon signature verification by limiting the number of modular reductions in the first place in #1623 . So we can safely close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Related to Miden standard library
Projects
None yet
Development

No branches or pull requests

2 participants