HEaaN
Crypto Lab's great homomorphic encryption library
include
HEaaN
Bootstrapper.hpp
Go to the documentation of this file.
1
// //
3
// Copyright (C) 2021-2023 Crypto Lab Inc. //
4
// //
5
// - This file is part of HEaaN homomorphic encryption library. //
6
// - HEaaN cannot be copied and/or distributed without the express permission //
7
// of Crypto Lab Inc. //
8
// //
10
11
#pragma once
12
13
#include "
Context.hpp
"
14
#include "
HEaaN/HEaaNExport.hpp
"
15
16
namespace
HEaaN
{
17
18
class
BootstrapperImpl;
19
class
Ciphertext
;
20
class
Device
;
21
class
HomEvaluator
;
22
26
class
HEAAN_API
Bootstrapper
{
27
public
:
34
explicit
Bootstrapper
(
const
HomEvaluator
&eval,
const
u64
log_slots);
35
explicit
Bootstrapper
(
const
HomEvaluator
&eval);
36
50
explicit
Bootstrapper
(
const
HomEvaluator
&eval,
51
const
Context
&context_sparse,
const
u64
log_slots);
52
explicit
Bootstrapper
(
const
HomEvaluator
&eval,
53
const
Context
&context_sparse);
54
59
bool
isBootstrapReady(
const
u64
log_slots)
const
;
60
65
void
makeBootConstants(
const
u64
log_slots);
66
71
// loaded on CPU when performing makeBootConstants. To perform
72
// bootstrap on Ciphertext on GPU memory, these constants should
73
// be loaded on GPU. You may manually load the constants to reduce
74
// latency of bootstrap. Otherwise, the first execution of bootstrap
75
// on GPU will automatically load the constants on the device.
77
void
loadBootConstants(
const
u64
log_slots,
const
Device
&device)
const
;
78
80
u64
getLevelAfterFullSlotBootstrap()
const
;
81
83
u64
getMinLevelForBootstrap()
const
;
84
93
void
bootstrap(
const
Ciphertext
&ctxt,
Ciphertext
&ctxt_out,
94
bool
is_complex =
false
)
const
;
95
104
void
bootstrap(
const
Ciphertext
&ctxt,
Ciphertext
&ctxt_out_real,
105
Ciphertext
&ctxt_out_imag)
const
;
106
117
void
bootstrapExtended(
const
Ciphertext
&ctxt,
Ciphertext
&ctxt_out,
118
bool
is_complex =
false
)
const
;
119
129
void
bootstrapExtended(
const
Ciphertext
&ctxt,
Ciphertext
&ctxt_out_real,
130
Ciphertext
&ctxt_out_imag)
const
;
131
132
private
:
133
std::shared_ptr<BootstrapperImpl>
impl_
;
134
};
135
136
}
// namespace HEaaN
HEaaN::Bootstrapper::impl_
std::shared_ptr< BootstrapperImpl > impl_
Definition:
Bootstrapper.hpp:133
HEaaN::HomEvaluator
A class consisting of basic operation of Ciphertext and Message.
Definition:
HomEvaluator.hpp:29
HEaaN::u64
std::uint64_t u64
Definition:
Integers.hpp:17
HEaaN::Device
Definition:
Device.hpp:33
HEaaN::Ciphertext
A class of ciphertexts each of which contains a vector of polynomials of length > 1.
Definition:
Ciphertext.hpp:27
HEaaN::Context
std::shared_ptr< ContextContent > Context
Definition:
Context.hpp:27
HEaaN::Bootstrapper
A class consisting of bootstrap and its related functions.
Definition:
Bootstrapper.hpp:26
Context.hpp
HEaaNExport.hpp
HEAAN_API
#define HEAAN_API
Definition:
HEaaNExport.hpp:26
HEaaN
Definition:
Bootstrapper.hpp:16
Generated by
1.8.17