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

[feat] add bits_to_num and limbs_to_num #222

Merged

Conversation

shuklaayush
Copy link
Contributor

@shuklaayush shuklaayush commented Nov 25, 2023

Adds a couple of functions to reconstruct field elements from their bit/limb representations

  • bits_to_num to GateInstructions
  • limbs_to_num to RangeInstructions

Assumes the bit/limb representation is valid and doesn't range check the bits/limbs.

One thing to note is that there can be multiple bit/limb representations that map to the same field element. For eg. with 254 bits and working on BN254, both the bit representations of x and x + p (254 bits) will map to x. It might make sense to range check the input to be less than p in such a case

Copy link
Contributor

@jonathanpwang jonathanpwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonathanpwang jonathanpwang merged commit 400122a into axiom-crypto:community-edition Nov 26, 2023
2 checks passed
@shuklaayush shuklaayush deleted the feat/bits2num branch November 26, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants