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

bug: emulated Exp and ModExp take exponents as field elements #1148

Open
ivokub opened this issue May 29, 2024 · 0 comments
Open

bug: emulated Exp and ModExp take exponents as field elements #1148

ivokub opened this issue May 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working consolidate strengthen an existing feature doc

Comments

@ivokub
Copy link
Collaborator

ivokub commented May 29, 2024

The emulated methods Exp and ModExp take exponents as the same field elements as base, but in practice they do not belong to the field.

This is particularly case for the Exp method where when we obtain the exponent through a computation

l := f.Mul(b, c)
res := f.Exp(a, l)

then l can be either l or l+p (as the value is provided from hint). In this case, the result could be incorrect.

My proposal:

  • either omit Exp method as the method signature is just incorrect. Or it should take as an input frontend.Variable (or bits directly?) and we add documentation that we represent this as an integer.
  • add documentation for ModExp method which explains that exponent is not from the same field. Or we should already take bits as an input.

In both of the cases, actually it could be beneficial when we take directly bits as an input as this would allow to optimize the number of loops when computing the modular exponentiation (the number of loops is the length of the bits slice).

@ivokub ivokub added bug Something isn't working consolidate strengthen an existing feature doc labels May 29, 2024
@ivokub ivokub self-assigned this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working consolidate strengthen an existing feature doc
Projects
None yet
Development

No branches or pull requests

1 participant