-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgene.h
More file actions
74 lines (65 loc) · 1.94 KB
/
Copy pathgene.h
File metadata and controls
74 lines (65 loc) · 1.94 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include <vector>
#include <optional>
#include "seal/seal.h"
#include <stdio.h>
#include <stdlib.h>
using namespace std;
using namespace seal;
//define gene_scheme 1 for "BFV" 0 for "CKKS"
#define bfv 1
#define ckks 0
typedef pair<size_t, size_t> bucket_slot;
class GeneParams
{
public:
GeneParams(size_t poly_modulus_degree,bool gene_scheme);
// you *must* call either generate_seeds or set_seeds.
void generate_seeds();
void set_seeds(vector<uint64_t> &seeds_ext);
uint64_t plain_modulus();
size_t hash_functions();
size_t bucket_count_log();
size_t sender_bucket_capacity();
size_t sender_partition_count();
size_t window_size();
Ciphertext encrypted_genedata(vector<double_t> &gene_data,Encryptor &encryptor,bool gene_scheme);
vector<double> decrypt_data(Ciphertext &ciphertex,Decryptor &decryptor,CKKSEncoder &encoder);
void set_sender_partition_count(size_t new_value);
size_t receiver_size;
size_t sender_size;
size_t input_bits;
shared_ptr<SEALContext> context;
vector<uint64_t> seeds;
PublicKey pub_key;
RelinKeys relin_key;
SecretKey sec_key;
private:
size_t poly_modulus_degree_;
size_t sender_partition_count_;
};
class GeneSender
{
public:
GeneSender(GeneParams ¶ms);
//vector<Ciphertext> encrypt_inputs(vector<uint64_t> &inputs, vector<bucket_slot> &buckets);
//vector<size_t> decrypt_matches(vector<Ciphertext> &encrypted_matches);
//vector<pair<size_t, uint64_t>> decrypt_labeled_matches(vector<Ciphertext> &encrypted_matches);
PublicKey& public_key();
vector<Ciphertext> encrypted_genedata(vector<double_t> &gene_data);
RelinKeys& relin_keys();
SecretKey& secret_key();
private:
GeneParams ¶ms;
KeyGenerator keygen;
PublicKey public_key_;
SecretKey secret_key_;
RelinKeys relin_key_;
};
class GeneReceiver
{
public:
GeneReceiver(GeneParams ¶ms);
private:
GeneParams ¶ms;
};