-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathevalkeygen.cpp
More file actions
45 lines (41 loc) · 1.16 KB
/
evalkeygen.cpp
File metadata and controls
45 lines (41 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifdef USE_PERF
#include <gperftools/profiler.h>
#endif
#include <cereal/archives/portable_binary.hpp>
#include <cereal/types/vector.hpp>
#include <chrono>
#include <fstream>
#include <iostream>
#include <memory>
#include <random>
#include <tfhe++.hpp>
int main()
{
// generate a random key
using brP = TFHEpp::lvl02param;
using xorbrP = TFHEpp::lvl01param;
using briksP = TFHEpp::lvl10param;
using cbiksP = TFHEpp::lvl21param;
using privksP = TFHEpp::lvl21param;
// To see performance
std::chrono::system_clock::time_point start, end;
#ifdef USE_PERF
ProfilerStart("evalkeyen.prof");
#endif
start = std::chrono::system_clock::now();
std::unique_ptr<TFHEpp::SecretKey> sk(new TFHEpp::SecretKey);
TFHEpp::EvalKey ek;
ek.emplaceiksk<briksP>(*sk);
ek.emplaceiksk<cbiksP>(*sk);
ek.emplacebkfft<brP>(*sk);
ek.emplacebkfft<xorbrP>(*sk);
ek.emplaceprivksk4cb<privksP>(*sk);
#ifdef USE_PERF
ProfilerStop();
#endif
end = std::chrono::system_clock::now();
double elapsed =
std::chrono::duration_cast<std::chrono::milliseconds>(end - start)
.count();
std::cout << elapsed << "ms" << std::endl;
}