Commit 1369d029 authored by Hoang Gia NGUYEN's avatar Hoang Gia NGUYEN
Browse files

testing

parent d4e94487

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
/*
(C) Copyright 2022 CEA LIST. All Rights Reserved.
*/
#ifndef _PRINT_API_H_
#define _PRINT_API_H_
/* includes */
#include <iostream>
#include <random>
#include <cstdio>
#include <vector>
#include <time.h>
/* prototypes */
void print_vectors(std::vector<int64_t>& v);
void print_vectors(std::vector<double> &v);
void print_matrix(std::vector<std::vector<int64_t>>& m);
void print_matrix(std::vector<std::vector<double>>& m);
void rand_vector(int seed, uint64_t v_space, uint32_t v_size, std::vector<int64_t>& v);
void rand_vector(int seed, uint64_t v_space, uint32_t v_size, std::vector<double>& v);
#endif
This diff is collapsed.
#ifndef _SEAL_API_H_
#define _SEAL_API_H_
/* includes */
#include <sys/time.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
#include <cassert>
#include <cstdint>
#include <boost/lexical_cast.hpp>
#include "seal/seal.h"
#include "csv_api.h"
/** BFV definitions **/
struct encryptor_t {
std::shared_ptr<seal::SEALContext> context;
seal::Encryptor *encr;
seal::BatchEncoder *bcode;
seal::IntegerEncoder *icode;
};
struct decryptor_t {
std::shared_ptr<seal::SEALContext> context;
seal::Decryptor *decr;
seal::BatchEncoder *bcode;
seal::IntegerEncoder *icode;
};
struct evaluator_t {
std::shared_ptr<seal::SEALContext> context;
seal::RelinKeys lk;
seal::GaloisKeys gk;
seal::Evaluator *eval;
};
/** CKKS definitions **/
struct cencryptor_t {
// seal::SEALContext context{0};
std::shared_ptr<seal::SEALContext> context;
seal::Encryptor* encr{nullptr};
seal::CKKSEncoder* ccode{nullptr};
double scale{0};
};
struct cdecryptor_t {
// seal::SEALContext context{0};
std::shared_ptr<seal::SEALContext> context;
seal::Decryptor* decr{nullptr};
seal::CKKSEncoder* ccode{nullptr};
double scale{0};
};
struct cevaluator_t {
// seal::SEALContext context{0};
std::shared_ptr<seal::SEALContext> context;
seal::RelinKeys lk{};
seal::GaloisKeys gk{};
seal::Evaluator* eval{nullptr};
double scale{0};
};
/** prototypes **/
/** for binary files management **/
int open_binary_file(std::ifstream& in_file, const std::string& filename);
int open_binary_file(std::ofstream& out_file, const std::string& filename);
/** for context management **/
int save_params(seal::EncryptionParameters &params, const std::string &filename);
int load_params(seal::EncryptionParameters &params, const std::string &filename);
void init_context(size_t poly_d, size_t p_modulus, std::shared_ptr<seal::SEALContext>& context);
void load_context(std::shared_ptr<seal::SEALContext>& context, const std::string& filename);
void print_context(std::shared_ptr<seal::SEALContext>& context);
/** for key management **/
int save_key(seal::PublicKey& k, const std::string& filename);
int save_key(seal::SecretKey& k, const std::string& filename);
int save_key(seal::RelinKeys& k, const std::string& filename);
int save_key(seal::GaloisKeys& k, const std::string& filename);
int load_key(std::shared_ptr<seal::SEALContext>& context, const std::string& filename, seal::PublicKey& k);
int load_key(std::shared_ptr<seal::SEALContext>& context, const std::string& filename, seal::SecretKey& k);
int load_key(std::shared_ptr<seal::SEALContext>& context, const std::string& filename, seal::RelinKeys& k);
void generate_keys(size_t poly_d, size_t p_modulus, bool seriablizable = false);
void batching_generate_keys(size_t poly_d, int bit_size, const std::string key_path, bool serializable = false);
void batching_generate_keys(size_t poly_d, std::vector<int> bit_sizes, std::uint64_t plain_modulus, std::string key_dir, bool serializable = false);
/** for homomorphic operators management **/
void init_operator(struct encryptor_t& op_st);
void init_operator(struct encryptor_t &op_st, const std::string& public_key_path);
void init_operator_batching(struct encryptor_t &op_st, const std::string& key_dir);
void init_operator(struct decryptor_t& op_st);
void init_operator(struct decryptor_t &op_st, const std::string& secret_key_path);
void init_operator_batching(struct decryptor_t &op_st, const std::string& key_dir);
void init_operator(struct evaluator_t& op_st);
void init_operator(struct evaluator_t& op_st, const std::string& relink_key_path);
void init_operator_batching(struct evaluator_t &op_st, const std::string &key_dir);
void delete_operator(struct encryptor_t& op_st);
void delete_operator_batching(struct encryptor_t& op_st);
void delete_operator(struct decryptor_t& op_st);
void delete_operator_batching(struct decryptor_t& op_st);
void delete_operator(struct evaluator_t& op_st);
void delete_operator_batching(struct evaluator_t& op_st);
/** for plaintexts and ciphertexts management **/
void init_plaintext(struct encryptor_t& op_st, int64_t plain, seal::Plaintext& pt);
void init_ciphertext(struct encryptor_t& op_st, int64_t plain, seal::Ciphertext& ct);
void init_ciphermatrix(struct encryptor_t &op_st, std::vector<int64_t> &plain_matrix, seal::Ciphertext &encrypted_matrix);
void decrypt_ciphertext(struct decryptor_t& op_st, seal::Ciphertext& ct);
std::int64_t decrypt_ciphertext_and_return_value(struct decryptor_t& op_st, seal::Ciphertext& ct);
std::vector<int64_t> decrypt_ciphermatrix(struct decryptor_t &op_st, seal::Ciphertext &ct);
/*** ckks plaintexts ***/
void init_plaintext_ckks(seal::CKKSEncoder& encoder, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
void init_plaintext_ckks(struct cencryptor_t& op_st, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
void init_plaintext_ckks(struct cencryptor_t& op_st, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
void init_plaintext_ckks(struct cdecryptor_t& op_st, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
void init_plaintext_ckks(struct cdecryptor_t& op_st, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
int save_plaintext(seal::Plaintext& pt, const std::string& filename);
int save_ciphertext(seal::Ciphertext& ct, const std::string& filename);
int load_plaintext(std::shared_ptr<seal::SEALContext>& context, seal::Plaintext& pt, const std::string& filename);
int load_plaintext(struct evaluator_t& op_st, seal::Plaintext& pt, const std::string& filename);
int load_plaintext(struct decryptor_t& op_st, seal::Plaintext& pt, const std::string& filename);
int load_ciphertext(std::shared_ptr<seal::SEALContext>& context, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext(struct evaluator_t& op_st, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext(struct decryptor_t& op_st, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext_ckks(struct cevaluator_t& op_st, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext_ckks(struct cdecryptor_t& op_st, seal::Ciphertext& ct, const std::string& filename);
/** prototypes **/
/*** ckks opertors ***/
// int init_operator(struct cencryptor_t& op_st);
// int init_operator_ckks(struct cencryptor_t& op_st);
void init_operator_ckks(struct cencryptor_t &op_st, const std::string& key_dir);
void init_operator_ckks(struct cdecryptor_t &op_st, const std::string& key_dir);
void init_operator_ckks(struct cevaluator_t& op_st, const std::string& key_dir);
// int init_operator(struct cdecryptor_t& op_st);
// int init_operator(struct cevaluator_t& op_st);
void delete_operator_ckks(struct cencryptor_t& op_st);
void delete_operator_ckks(struct cdecryptor_t& op_st);
void delete_operator_ckks(struct cevaluator_t& op_st);
// void delete_operator(struct cevaluator_t& op_st);
/*** ckks plaintexts ***/
// void init_plaintext(seal::CKKSEncoder& encoder, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
// void init_plaintext(struct cencryptor_t& op_st, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
// void init_plaintext(struct cencryptor_t& op_st, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
// void init_plaintext(struct cdecryptor_t& op_st, double scale, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
// void init_plaintext(struct cdecryptor_t& op_st, std::vector<double>& p_vector, seal::Plaintext& pt, bool print_info = 1);
/*** ckks ciphertexts ***/
void init_ciphertext_ckks(seal::CKKSEncoder& encoder, seal::Encryptor& encryptor, double scale, std::vector<double>& c_vector, seal::Ciphertext& ct);
void init_ciphertext_ckks(struct cencryptor_t& op_st, double scale, std::vector<double>& c_vector, seal::Ciphertext& ct);
void init_ciphertext_ckks(struct cencryptor_t& op_st, std::vector<double>& c_vector, seal::Ciphertext& ct);
/*** ckks decryption ***/
void decrypt_ciphertext_ckks(seal::CKKSEncoder& encoder, seal::Decryptor& decryptor, seal::Ciphertext& ct, std::vector<double>& pt_val);
void decrypt_ciphertext_ckks(struct cdecryptor_t& op_st, seal::Ciphertext& ct, std::vector<double>& pt_val);
// std::vector<double> decrypt_ciphermatrix_ckks(struct cdecryptor_t &op_st, seal::Ciphertext &ct);
/*** saving plaintexts and ciphertexts ***/
int load_plaintext_ckks(struct cevaluator_t& op_st, seal::Plaintext& pt, const std::string& filename);
int load_plaintext_ckks(struct cencryptor_t& op_st, seal::Plaintext& pt, const std::string& filename);
int load_plaintext_ckks(struct cdecryptor_t& op_st, seal::Plaintext& pt, const std::string& filename);
int load_ciphertext_ckks(struct cevaluator_t& op_st, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext_ckks(struct cencryptor_t& op_st, seal::Ciphertext& ct, const std::string& filename);
int load_ciphertext_ckks(struct cdecryptor_t& op_st, seal::Ciphertext& ct, const std::string& filename);
void generate_keys_ckks(size_t poly_d, int bit_size, const std::string key_path, bool serializable = false);
/*** sum ***/
// void sum_batch_ciphertext(struct cevaluator_t& op_st, std::vector<seal::Ciphertext>& ct, seal::Ciphertext& ct_out);
/*** testing ***/
// void test_ckks_batch_functions(const uint32_t poly_deg);
#endif
1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1
\ No newline at end of file
4,5,2,2,4,7,1,5,7,1,2,3,0,7,5,9,2,0,6,4,3,4,9,0,8
\ No newline at end of file
9,6,7,8,6,0,9,6,7,4,8,6,6,2,1,1,6,5,3,7,4,0,3,1,1
\ No newline at end of file
8,7,0,7,0,9,9,1,4,2,9,3,0,4,9,7,0,7,2,3,7,1,9,5,1
\ No newline at end of file
1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9
2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9
3.1,3.2,3.3,3.4,3.5,3.6,3.7,3.8,3.9
4.1,4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9
5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9
6.1,6.2,6.3,6.4,6.5,6.6,6.7,6.8,6.9
7.1,7.2,7.3,7.4,7.5,7.6,7.7,7.8,7.9
8.1,8.2,8.3,8.4,8.5,8.6,8.7,8.8,8.9
9.1,9.2,9.3,9.4,9.5,9.6,9.7,9.8,9.9
10.1,10.2,10.3,10.4,10.5,10.6,10.7,10.8,10.9
11.1,11.2,11.3,11.4,11.5,11.6,11.7,11.8,11.9
12.1,12.2,12.3,12.4,12.5,12.6,12.7,12.8,12.9
13.1,13.2,13.3,13.4,13.5,13.6,13.7,13.8,13.9
14.1,14.2,14.3,14.4,14.5,14.6,14.7,14.8,14.9
15.1,15.2,15.3,15.4,15.5,15.6,15.7,15.8,15.9
16.1,16.2,16.3,16.4,16.5,16.6,16.7,16.8,16.9
17.1,17.2,17.3,17.4,17.5,17.6,17.7,17.8,17.9
18.1,18.2,18.3,18.4,18.5,18.6,18.7,18.8,18.9
19.1,19.2,19.3,19.4,19.5,19.6,19.7,19.8,19.9
20.1,20.2,20.3,20.4,20.5,20.6,20.7,20.8,20.9
21.1,21.2,21.3,21.4,21.5,21.6,21.7,21.8,21.9
22.1,22.2,22.3,22.4,22.5,22.6,22.7,22.8,22.9
23.1,23.2,23.3,23.4,23.5,23.6,23.7,23.8,23.9
24.1,24.2,24.3,24.4,24.5,24.6,24.7,24.8,24.9
25.1,25.2,25.3,25.4,25.5,25.6,25.7,25.8,25.9
\ No newline at end of file
4,1,9,0,0,4,6,0,1,4,9,3,1,7,2,2,3,7,5,9,7,4,6,4,7
5,9,3,6,1,8,3,9,9,0,4,3,1,9,8,9,2,0,3,8,3,7,0,2,1
8,5,9,7,4,0,5,6,0,0,4,8,4,3,8,7,3,4,8,0,8,8,9,9,3
9,5,0,5,6,9,5,9,9,5,3,7,8,6,0,0,1,1,4,7,2,8,2,5,0
1,4,9,8,7,9,7,3,5,5,9,3,2,6,8,3,8,5,8,8,4,5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,1,8
0,6,6,1,5,9,7,2,8,8,3,8,6,7,8,1,8,0,0,5,9,7,1,4,7
9,8,6,7,9,6,1,5,3,6,1,8,6,5,1,4,2,9,0,8,8,1,9,0,3
2,0,6,1,6,7,7,4,7,3,7,9,6,6,3,2,3,1,7,0,6,7,1,2,5
2,1,4,1,0,1,7,4,2,1,5,8,2,9,4,9,8,8,0,3,9,8,1,4,5
7,2,4,9,5,0,5,9,1,3,0,3,9,6,9,7,6,6,3,6,0,4,9,7,6
8,8,5,7,9,0,6,2,2,3,1,1,7,2,2,0,2,5,1,3,9,5,3,3,6
1,7,0,2,2,0,1,5,3,0,7,7,8,9,6,8,9,2,0,6,7,9,8,4,8
5,3,3,5,7,2,5,0,6,5,1,5,1,6,6,8,2,9,5,7,1,1,5,1,3
3,1,0,1,6,9,2,2,9,7,0,8,8,7,7,7,7,8,6,3,0,0,5,5,9
\ No newline at end of file
1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1
\ No newline at end of file
w1
1.1 1.2 1.3
2.1 2.2 2.3
3.1 3.2 3.3
x1
1
2
3
b1
1.1
2.1
3.1
w1x1
7.4
13.4
19.4
w1x1b1
8.5
15.5
22.5
C1
1 15.8
2 15.2
3 14.6
3.6 13.2 28.8
4.7 15.3 31.9
Ciphertext getIndexVector(cencryptor_t &encr, cevaluator_t &eval, Ciphertext vector_ct, int slot_count, int index)
{
vector<double> index_vector(slot_count, 0ULL);
// vector<double> index_vector;
index_vector[index] = 1ULL;
Plaintext index_vector_pt;
init_plaintext_ckks(encr, index_vector, index_vector_pt);
multiply_plain_inplace_ckks(eval, vector_ct, index_vector_pt);
relinearize_inplace_ckks(eval, vector_ct);
rescale_to_next_inplace_ckks(eval, vector_ct);
vector_ct.scale() = pow(2.0, 40);
Ciphertext result = vector_ct;
for (size_t i = 0; i < slot_count; i++)
{
/* code */
// eval.eval->rotate_rows_inplace(vector_ct, 1, eval.gk);
eval.eval->rotate_vector(vector_ct, 1, eval.gk, vector_ct);
relinearize_inplace_ckks(eval, vector_ct);
rescale_to_next_inplace_ckks(eval, vector_ct);
vector_ct.scale() = pow(2.0, 40);
add_ciphertext_ckks(eval, result, vector_ct, result);
relinearize_inplace_ckks(eval, vector_ct);
rescale_to_next_inplace_ckks(eval, vector_ct);
vector_ct.scale() = pow(2.0, 40);
}
return result;
}
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 23.1 24.1 25.1
/ANN_encrypt_v1 "1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 23.1 24.1 25.1" "x" ./ "25" keys/
time ./ANN_evaluate_v1 testSet2/w1.csv testSet2/w2.csv testSet2/w3.csv testSet2/w4.csv testSet2/x.ct testSet2/b1.csv testSet2/b2.csv testSet2/b3.csv testSet2/b4.csv "testSet2/test" ./ 3 keys/
time ./ANN_decrypt_v1 testSet2/test.ct 3 keys/
time ./ANN_encrypt_v1 "1 2 3" "x" ./testSet2/ "3" keys/
./ANN_genkey_v1 keys/
time ./ANN_evaluate_v1 testSet1/w1.csv testSet1/w2.csv testSet1/w3.csv testSet1/w4.csv testSet1/x.ct testSet1/b1.csv testSet1/b2.csv testSet1/b3.csv testSet1/b4.csv "testSet1/test" ./ 25 keys/
time ./ANN_decrypt_v1 testSet1/test.ct 25 keys/
time ./ANN_encrypt_v1 "1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 20.1 21.1 22.1 23.1 24.1 25.1" "x" ./testSet1/ "25" keys/
./ANN_genkey_v1 keys/
\ No newline at end of file
1.1,2.1,3.1
\ No newline at end of file
8,7,0,7,0,9,9,1,4,2,9,3,0,4,9,7,0,7,2,3,7,1,9,5,1
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment