Skip to content

Commit

Permalink
update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
CblPOK-git committed Feb 16, 2024
1 parent 30c1181 commit 71d9efb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include <nil/crypto3/algebra/curves/pallas.hpp>

using namespace nil::crypto3::algebra::curves;
typename pallas::base_field_type::value_type pow(typename pallas::base_field_type::value_type a, int n) {
if (n == 0)
return 1;
typename pallas::base_field_type::value_type pow_2(typename pallas::base_field_type::value_type a) {

typename pallas::base_field_type::value_type res = 1;
for (int i = 0; i < n; ++i) {
for (int i = 0; i < 2; ++i) {
res *= a;
}
return res;
Expand All @@ -19,5 +17,5 @@ typename pallas::base_field_type::value_type pow(typename pallas::base_field_typ

typename pallas::base_field_type::value_type c = (a + b) * a + b * (a + b) * (a + b);
const typename pallas::base_field_type::value_type constant = 0x12345678901234567890_cppui255;
return c * c * c / (b - a) + pow(a, 2) + constant + p;
return c * c * c / (b - a) + pow_2(a) + constant + p;
}

0 comments on commit 71d9efb

Please sign in to comment.