Search projects, hackathons, sponsors and tech

    ← All projects

    Noir-KZG

    This work contains an implementation of the KZG commitment scheme for polynomials using the Noir language.

    Demo

    About

    This work contains an implementation of the KZG commitment scheme for polynomials using the Noir language. The KZG commitment scheme is described in detail in [this paper](https://eprint.iacr.org/2010/622.pdf). The current implementation is simplified and not optimized for performance.

    How it's made

    In the scenario provided, the project is built using the Noir programming language, which is focused on cryptographic computations. Here's a breakdown of how the project is pieced together based on the code snippet provided earlier: ### Technologies Used: 1. **Noir Language:** - Noir is a domain-specific language tailored for cryptographic computations. It provides a simplistic yet expressive syntax for defining and manipulating mathematical structures, making it suitable for implementing cryptographic schemes like the KZG commitment scheme. ### Project Structure: 1. **Main File (`main.nr`):** - This file hosts the implementation of the KZG commitment scheme. ### Implementation Details: 1. **Commitment Computation (`commit` function):** - The `commit` function takes a generator `g` and a polynomial `p` as inputs and computes the polynomial commitment `c` using the formula described in the code comments. - This function loops through the coefficients of the polynomial `p`, multiplying each coefficient by the respective power of the generator `g`, and accumulates the results to compute `c`. 2. **Evaluation Key Computation (`eval` function):** - The `eval` function takes an evaluation key `e` and a point `x`, and computes the evaluation `v` of the key `e` at the point `x`. - This function also loops through, but instead of working with the coefficients of a polynomial, it operates on the evaluation key `e`. 3. **Main Function (`main` function):** - The `main` function demonstrates the usage of the `commit` and `eval` functions by calling them with specific inputs and verifying the correctness of the scheme using an assertion. 4. **Testing (`test_main` function):** - A simple test function is provided to exemplify the usage of the `main` function with specific values. ### Noteworthy Hacks: - The implementation appears to be straightforward without any particular hacky or unconventional techniques. - However, this implementation is noted as being not optimized for performance, indicating there may be room for optimization or more efficient implementations. ### Benefits: - This implementation provides a working example of the KZG commitment scheme in Noir, which could serve as a foundation for further development or optimization. - The simplicity of the implementation makes it easy to understand and extend, which is beneficial for developers looking to explore cryptographic schemes using Noir. The project is a neat encapsulation of the KZG commitment scheme in Noir, demonstrating the ease with which cryptographic algorithms can be implemented using domain-specific languages.