-
Notifications
You must be signed in to change notification settings - Fork 51
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
a9bac5a
commit 615f62f
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
tests/cpp/algebra/fields/pallas_arithmetics/private_input_add.cpp
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef __ZKLLVM__ | ||
#include "../../../read_boost_json.hpp" | ||
#include <fstream> | ||
#endif | ||
|
||
#include <nil/crypto3/algebra/curves/pallas.hpp> | ||
|
||
using namespace nil::crypto3::algebra::curves; | ||
|
||
[[circuit]] typename pallas::base_field_type::value_type | ||
pallas_field_add([[private_input]] typename pallas::base_field_type::value_type a, | ||
[[private_input]] typename pallas::base_field_type::value_type b) { | ||
|
||
typename pallas::base_field_type::value_type c = a + b; | ||
|
||
#ifndef __ZKLLVM__ | ||
std::cout << c.data <<std::endl; | ||
#endif | ||
|
||
return c; | ||
} | ||
|
||
#ifndef __ZKLLVM__ | ||
|
||
int main (int argc, char *argv[]){ | ||
if (argc != 2) { | ||
std::cerr << "one command line argument must be provided\n"; | ||
std::abort(); | ||
} | ||
|
||
boost::json::value input_json = read_boost_json(std::string(argv[1])); | ||
|
||
using BlueprintFieldType = typename pallas::base_field_type; | ||
typename BlueprintFieldType::value_type a = read_field <BlueprintFieldType>(input_json, 0); | ||
typename BlueprintFieldType::value_type b = read_field <BlueprintFieldType>(input_json, 1); | ||
|
||
pallas_field_add(a, b); | ||
return 0; | ||
} | ||
#endif |