-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3eb2601
commit fb19751
Showing
19 changed files
with
1,506 additions
and
730 deletions.
There are no files selected for viewing
219 changes: 102 additions & 117 deletions
219
...s/blueprint/include/nil/blueprint/bbf/components/algebra/curves/weierstrass/ec_double.hpp
Large diffs are not rendered by default.
Oops, something went wrong.
561 changes: 0 additions & 561 deletions
561
...ueprint/include/nil/blueprint/bbf/components/algebra/curves/weierstrass/ec_double_old.hpp
This file was deleted.
Oops, something went wrong.
493 changes: 493 additions & 0 deletions
493
...blueprint/include/nil/blueprint/bbf/components/algebra/curves/weierstrass/ec_full_add.hpp
Large diffs are not rendered by default.
Oops, something went wrong.
389 changes: 389 additions & 0 deletions
389
...int/include/nil/blueprint/bbf/components/algebra/curves/weierstrass/ec_incomplete_add.hpp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
//---------------------------------------------------------------------------// | ||
// Copyright (c) 2024 Valeh Farzaliyev <[email protected]> | ||
// Copyright (c) 2024 Antoine Cyr <antoine.cyr@nil.foundation> | ||
// Copyright (c) 2024 Antoine Cyr <antoinecyr@nil.foundation> | ||
// | ||
// MIT License | ||
// | ||
|
@@ -22,7 +22,7 @@ | |
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
//---------------------------------------------------------------------------// | ||
// @file Declaration of interfaces for FRI verification array swapping component. | ||
// @file Declaration of interfaces for addition function on mod p. | ||
//---------------------------------------------------------------------------// | ||
|
||
#ifndef CRYPTO3_BBF_COMPONENTS_ADDITION_MOD_P_HPP | ||
|
@@ -52,8 +52,8 @@ namespace nil { | |
// operates on k-chunked x,y, p, p' | ||
// Parameters: num_chunks = k, bit_size_chunk = b | ||
// Input: x[0], ..., x[k-1], y[0], ..., y[k-1], p[0], ..., p[k-1], p'[0], ..., p'[k-1], 0 | ||
// Intemmediate values: q, t[0], ..., t[k-1], carry[k-1], t'[0], ..., t'[k-1], t"[0], ..., t"[k-1], carry"[k-1] | ||
// Output: z[0] = x[0] + y[0] - qp[0], ..., z[k-1] = x[k-1] + y[k-1] -qp[k-1] | ||
// Intermediate values: q, t[0], ..., t[k-1], carry[k-1], t'[0], ..., t'[k-1], t"[0], ..., t"[k-1], carry"[k-1] | ||
// Output: r[0] = x[0] + y[0] - qp[0], ..., r[k-1] = x[k-1] + y[k-1] -qp[k-1] | ||
// | ||
|
||
template<typename FieldType> | ||
|
@@ -111,7 +111,7 @@ namespace nil { | |
std::vector<TYPE> inp_y; | ||
std::vector<TYPE> inp_p; | ||
std::vector<TYPE> inp_pp; | ||
std::vector<TYPE> res_z; | ||
std::vector<TYPE> res_r; | ||
|
||
static table_params get_minimal_requirements( | ||
std::size_t num_chunks, std::size_t bit_size_chunk) { | ||
|
@@ -234,24 +234,24 @@ namespace nil { | |
|
||
Carry_On_Addition ca_1 = Carry_On_Addition( | ||
context_object, X, Y, num_chunks, bit_size_chunk); | ||
Range_Check rc_1 = Range_Check(context_object, ca_1.res_z, | ||
Range_Check rc_1 = Range_Check(context_object, ca_1.res_r, | ||
num_chunks, bit_size_chunk); | ||
//(qp = 0 or p) | ||
Choice_Function cf = | ||
Choice_Function(context_object, Q, ZERO, P, num_chunks); | ||
|
||
Carry_On_Addition ca_2 = | ||
Carry_On_Addition(context_object, cf.res_z, Z, num_chunks, | ||
Carry_On_Addition(context_object, cf.res_r, Z, num_chunks, | ||
bit_size_chunk); // qp + z | ||
|
||
// carry_on_addition results should be equal to each other x + y = z + qp | ||
|
||
for (std::size_t i = 0; i < num_chunks; i++) { | ||
copy_constrain(ca_1.res_z[i], ca_2.res_z[i]); | ||
copy_constrain(ca_1.res_r[i], ca_2.res_r[i]); | ||
} | ||
copy_constrain(ca_1.res_c, ca_2.res_c); | ||
|
||
Range_Check rc_2 = Range_Check(context_object, ca_2.res_z, | ||
Range_Check rc_2 = Range_Check(context_object, ca_2.res_r, | ||
num_chunks, bit_size_chunk); | ||
|
||
Range_Check rc_3 = | ||
|
@@ -277,7 +277,7 @@ namespace nil { | |
inp_pp.push_back(input_pp[i]); | ||
} | ||
for (int i = 0; i < num_chunks; ++i) { | ||
res_z.push_back(Z[i]); | ||
res_r.push_back(Z[i]); | ||
} | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
//---------------------------------------------------------------------------// | ||
// Copyright (c) 2024 Georgios Fotiadis <[email protected]> | ||
// Copyright (c) 2024 Alexey Yashunsky <[email protected]> | ||
// Copyright (c) 2024 Antoine Cyr <antoine.cyr@nil.foundation> | ||
// Copyright (c) 2024 Antoine Cyr <antoinecyr@nil.foundation> | ||
// | ||
// MIT License | ||
// | ||
|
@@ -23,7 +23,7 @@ | |
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
//---------------------------------------------------------------------------// | ||
// @file Declaration of interfaces for FRI verification array swapping component. | ||
// @file Declaration of interfaces for negation function on mod p. | ||
//---------------------------------------------------------------------------// | ||
|
||
#ifndef CRYPTO3_BBF_COMPONENTS_NEGATION_MOD_P_HPP | ||
|
@@ -50,9 +50,9 @@ namespace nil { | |
namespace bbf { | ||
namespace components { | ||
// Parameters: num_chunks = k, bit_size_chunk = b | ||
// Finding the negative y of integer x, modulo p and checking that x + y = 0 mod p | ||
// Finding the negative r of integer x, modulo p and checking that x + r = 0 mod p | ||
// Input: x[0], ..., x[k-1], p[0], ..., p[k-1], pp[0], ..., pp[k-1], 0 (expects zero constant as input) | ||
// Output: y[0], ..., y[k-1] | ||
// Output: r[0], ..., r[k-1] | ||
|
||
template<typename FieldType> | ||
struct negation_mod_p_raw_input { | ||
|
@@ -107,7 +107,7 @@ namespace nil { | |
std::vector<TYPE> inp_x; | ||
std::vector<TYPE> inp_p; | ||
std::vector<TYPE> inp_pp; | ||
std::vector<TYPE> res_z; | ||
std::vector<TYPE> res_r; | ||
|
||
static table_params get_minimal_requirements( | ||
std::size_t num_chunks, std::size_t bit_size_chunk) { | ||
|
@@ -224,7 +224,7 @@ namespace nil { | |
|
||
// x + y = 0 or p | ||
for (std::size_t i = 0; i < num_chunks; i++) { | ||
copy_constrain(ca.res_z[i], cf.res_z[i]); | ||
copy_constrain(ca.res_r[i], cf.res_r[i]); | ||
} | ||
copy_constrain(ca.res_c, ZERO[0]); | ||
|
||
|
@@ -249,7 +249,7 @@ namespace nil { | |
inp_pp.push_back(input_pp[i]); | ||
} | ||
for (int i = 0; i < num_chunks; ++i) { | ||
res_z.push_back(Y[i]); | ||
res_r.push_back(Y[i]); | ||
} | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
//---------------------------------------------------------------------------// | ||
// Copyright (c) 2024 Alexey Yashunsky <[email protected]> | ||
// Copyright (c) 2024 Antoine Cyr <antoine.cyr@nil.foundation> | ||
// Copyright (c) 2024 Antoine Cyr <antoinecyr@nil.foundation> | ||
// | ||
// MIT License | ||
// | ||
|
@@ -65,7 +65,7 @@ namespace nil { | |
|
||
public: | ||
TYPE inp_q; | ||
std::vector<TYPE> inp_x, inp_y, res_z; | ||
std::vector<TYPE> inp_x, inp_y, res_r; | ||
|
||
static table_params get_minimal_requirements(std::size_t num_chunks) { | ||
std::size_t witness = num_chunks + 1; | ||
|
@@ -133,7 +133,7 @@ namespace nil { | |
for (std::size_t i = 0; i < num_chunks; i++) { | ||
inp_x.push_back(X[i]); | ||
inp_y.push_back(Y[i]); | ||
res_z.push_back(Z[i]); | ||
res_r.push_back(Z[i]); | ||
} | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.