HEaaN
Crypto Lab's great homomorphic encryption library
Context.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 <memory>
14 #include <string>
15 #include <vector>
16 
17 #include "HEaaN/Integers.hpp"
19 #include "HEaaN/SecurityLevel.hpp"
20 #include "HEaaN/device/Device.hpp"
21 #include "HEaaNExport.hpp"
22 #include "Real.hpp"
23 
24 namespace HEaaN {
25 
26 class ContextContent;
27 using Context = std::shared_ptr<ContextContent>;
28 
40  const CudaDeviceIds &cuda_device_ids = {});
41 
84 HEAAN_API Context makeContext(const u64 log_dimension, const u64 chain_length,
85  const u64 bpsize, const u64 qpsize,
86  const u64 tpsize, const u64 gadget_rank,
87  const CudaDeviceIds &cuda_device_ids = {});
88 
98  const std::string &filename, const CudaDeviceIds &cuda_device_ids = {});
99 
104 HEAAN_API void saveContextToFile(const Context &context,
105  const std::string &filename);
106 
114 HEAAN_API u64 getLogFullSlots(const Context &context);
115 
123 HEAAN_API u64 getEncryptionLevel(const Context &context);
124 
130 HEAAN_API std::vector<Real> getDefaultScaleFactorList(const Context &context);
131 
135 HEAAN_API std::vector<u64> getPrimeList(const Context &context);
136 
139 HEAAN_API bool isBootstrappableParameter(const Context &context);
140 
148 
151 HEAAN_API bool isExtendedBootstrapSupported(const Context &context);
152 
156 HEAAN_API std::set<i64> getRotIndicesForBootstrap(const Context &context,
157  u64 log_slots);
158 
169 
170 } // namespace HEaaN
HEaaN::SecurityLevel
enum HEAAN_API SecurityLevel
Enum class for security levels.
Definition: SecurityLevel.hpp:24
HEaaN::getPrimeList
HEAAN_API std::vector< u64 > getPrimeList(const Context &context)
Get the list of primes.
HEaaN::CudaDeviceIds
std::set< int > CudaDeviceIds
Definition: Device.hpp:69
HEaaN::getEncryptionLevel
HEAAN_API u64 getEncryptionLevel(const Context &context)
Get the level of a fresh ciphertext, which is the maximum level that users can encrypt a ciphertext t...
HEaaN::isExtendedBootstrapSupported
HEAAN_API bool isExtendedBootstrapSupported(const Context &context)
Get whether the bootstrapping for extended range supported.
ParameterPreset.hpp
HEaaN::makeContextFromFile
HEAAN_API Context makeContextFromFile(const std::string &filename, const CudaDeviceIds &cuda_device_ids={})
Make a context object from a "context file".
HEaaN::ParameterPreset
enum HEAAN_API ParameterPreset
Class of Parameter presets.
Definition: ParameterPreset.hpp:29
Device.hpp
HEaaN::u64
std::uint64_t u64
Definition: Integers.hpp:17
HEaaN::isSparseSecretEncapsulationSupported
HEAAN_API bool isSparseSecretEncapsulationSupported(const Context &context)
Get whether the given context supports sparse secret encapsulation or not.
HEaaN::isBootstrappableParameter
HEAAN_API bool isBootstrappableParameter(const Context &context)
Get whether the bootstrapping is supported.
HEaaN::getDefaultScaleFactorList
HEAAN_API std::vector< Real > getDefaultScaleFactorList(const Context &context)
Get the default list of scale factors.
HEaaN::getSecurityLevel
HEAAN_API SecurityLevel getSecurityLevel(const Context &context)
Get the security level of the given context.
HEaaN::getLogFullSlots
HEAAN_API u64 getLogFullSlots(const Context &context)
Get the maximal logarithmic (base of 2) number of slots for the given context object.
SecurityLevel.hpp
HEaaN::getRotIndicesForBootstrap
HEAAN_API std::set< i64 > getRotIndicesForBootstrap(const Context &context, u64 log_slots)
Get the list of rotation key index for the bootstrapping process.
Integers.hpp
HEaaN::Context
std::shared_ptr< ContextContent > Context
Definition: Context.hpp:27
HEaaN::makeContext
HEAAN_API Context makeContext(const ParameterPreset &preset, const CudaDeviceIds &cuda_device_ids={})
Make a context object based on a given parameter preset.
HEaaNExport.hpp
HEAAN_API
#define HEAAN_API
Definition: HEaaNExport.hpp:26
HEaaN
Definition: Bootstrapper.hpp:16
HEaaN::saveContextToFile
HEAAN_API void saveContextToFile(const Context &context, const std::string &filename)
Save a context object into a file.
Real.hpp