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

Epic: Big Integers #510

Closed
6 tasks done
guipublic opened this issue Nov 21, 2022 · 4 comments
Closed
6 tasks done

Epic: Big Integers #510

guipublic opened this issue Nov 21, 2022 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@guipublic
Copy link
Contributor

guipublic commented Nov 21, 2022

Problem

In noir, the size of integers types are restricted to half of the field modulus. However to implement cryptographic schemes, for instance those based on EC operations, we need to support integers with bigger size.

Solution

Usual techniques for big integers consists into representing the big integers with smaller limbs, to use non-determinism to compute the result of an operation (+,*,-..) and to add constraints asserting the result is valid.
The solution described here suggest some efficient constraints to check the result: https://blog.polygon.technology/wp-content/uploads/2022/10/casting-3.pdf

Tasks

  1. enhancement
    guipublic
  2. enhancement
    guipublic
  3. documentation
    guipublic
  4. C-barretenberg
  5. enhancement

Alternatives considered

We should check whether or not it would be easy/efficient to implement big integers using a noir implementation, although I believe having big integers as a native noir type does make sense considering how useful it is.
It could be also interesting to see how big integers are implemented in Barretenberg

@guipublic guipublic added the enhancement New feature or request label Nov 21, 2022
@michaelneuder
Copy link

Agreed that this would be very useful! For a noir implementation of sha256, for example, having a u512 would be important because each chunk of the message is processed in 512 bit pieces. I tried using u512 only to realize that that size of integer is not supported: https://github.com/michaelneuder/crypto-primitives/blob/14ff0241182a7fac84c5e66ad4ddc8e75182b7bc/sha256/sha256/src/main.nr#L10.

@okuyiga
Copy link

okuyiga commented Dec 9, 2022

I'm working on an implementation of this here https://github.com/okuyiga/noir-mul-mod-non-determinstic

@Savio-Sou Savio-Sou added this to Noir Oct 16, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 16, 2023
@Savio-Sou Savio-Sou added this to the 1.0 milestone Oct 16, 2023
@Savio-Sou Savio-Sou removed this from the 1.0 milestone Nov 22, 2023
@kevaundray kevaundray added this to the 1.0 milestone Jan 15, 2024
@Savio-Sou Savio-Sou moved this from 📋 Backlog to 🏗 In progress in Noir Feb 22, 2024
@Savio-Sou Savio-Sou changed the title Big Integers Epic: Big Integers Feb 22, 2024
@Savio-Sou
Copy link
Collaborator

Update:
AztecProtocol/aztec-packages#5327 was closed due to Barretenberg team's concern on merging the PR.

Meanwhile, we've come up with a design spec that should be implementable in pure Noir. We're looking for a community team to implement and maintain it accordingly; if you reader are interested, do reach out.

@Savio-Sou
Copy link
Collaborator

This Epic in this repository is therefore no longer relevant, as the aim has shifted towards a standalone BigUInt library implementing the specs linked above. Closing as not planned.

@Savio-Sou Savio-Sou closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

5 participants