Compare commits

...

7 Commits

Author SHA1 Message Date
Phillip LaBanca 765f281adb Added new commits from bn256 submodule repo 2022-10-19 15:18:29 -05:00
Phillip LaBanca 314f95d76d Update scope of curve_gen and twist_gen 2022-10-13 15:50:56 -05:00
Phillip LaBanca 6f1cce5d13 Remove string comparison 2022-10-10 18:45:28 -05:00
Phillip LaBanca 1404bb83e7 Remove url .git extention for consistency 2022-10-04 12:06:42 -05:00
Phillip LaBanca f1f96883e1 Correct add_executable dependancy list 2022-10-04 11:54:11 -05:00
Phillip LaBanca d890f5bc9c Add benchmark test for bn256 2022-10-04 10:32:56 -05:00
Phillip LaBanca 45fd2ee201 Added bn256 submodule 2022-09-30 15:55:05 -05:00
7 changed files with 50 additions and 1 deletions
+3
View File
@@ -28,3 +28,6 @@
[submodule "libraries/libfc/libraries/ff"]
path = libraries/libfc/libraries/ff
url = https://github.com/AntelopeIO/libff
[submodule "libraries/libfc/libraries/bn256"]
path = libraries/libfc/libraries/bn256
url = https://github.com/AntelopeIO/bn256
+1 -1
View File
@@ -1,7 +1,7 @@
file(GLOB BENCHMARK "*.cpp")
add_executable( benchmark ${BENCHMARK} )
target_link_libraries( benchmark fc Boost::program_options )
target_link_libraries( benchmark fc bn256 Boost::program_options )
target_include_directories( benchmark PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
)
+1
View File
@@ -10,6 +10,7 @@ namespace benchmark {
// update this map when a new feature is supported
// key is the name and value is the function doing benchmarking
std::map<std::string, std::function<void()>> features {
{ "bn_256", bn_256_benchmarking },
{ "alt_bn_128", alt_bn_128_benchmarking },
{ "modexp", modexp_benchmarking },
{ "key", key_benchmarking },
+1
View File
@@ -14,6 +14,7 @@ std::map<std::string, std::function<void()>> get_features();
void print_header();
bytes to_bytes(const std::string& source);
void bn_256_benchmarking();
void alt_bn_128_benchmarking();
void modexp_benchmarking();
void key_benchmarking();
+42
View File
@@ -0,0 +1,42 @@
#include <iostream>
#include <bn256.h>
#include <benchmark.hpp>
namespace benchmark {
void benchmark_bn_256_g1() {
const auto x = int512_t("17482507071749278111455282041915610272829864719113987536544577255487650163890");
auto f = [&]() {
bn256::g1 g1{};
g1.scalar_base_mult(x);
};
benchmarking("bn_256_g1", f);
}
void benchmark_bn_256_g2() {
const auto x = int512_t("14506523411943850241455301787384885005987154472366374992538170185465884650319");
auto f = [&]() {
bn256::g2 g2{};
g2.scalar_base_mult(x);
};
benchmarking("bn_256_g2", f);
}
void benchmark_bn_256_pair() {
bn256::g1 g1{bn256::g1::curve_gen};
bn256::g2 g2{bn256::g2::twist_gen};
auto f = [&]() {
bn256::pair(g1, g2);
};
benchmarking("bn_256_pair", f);
}
void bn_256_benchmarking() {
benchmark_bn_256_g1();
benchmark_bn_256_g2();
benchmark_bn_256_pair();
}
}
+1
View File
@@ -6,6 +6,7 @@ set( USE_ASM OFF CACHE BOOL "" FORCE)
set( IS_LIBFF_PARENT OFF CACHE BOOL "" FORCE)
set( FF_INSTALL_COMPONENT "${FC_INSTALL_COMPONENT}")
add_subdirectory( libraries/ff )
add_subdirectory( libraries/bn256 )
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)