This work contains an implementation of the KZG commitment scheme for polynomials using the Noir language.
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. The current implementation is simplified and not optimized for performance.
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:
main.nr
):
Commitment Computation (commit
function):
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.p
, multiplying each coefficient by the respective power of the generator g
, and accumulates the results to compute c
.Evaluation Key Computation (eval
function):
eval
function takes an evaluation key e
and a point x
, and computes the evaluation v
of the key e
at the point x
.e
.Main Function (main
function):
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.Testing (test_main
function):
main
function with specific values.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.