HEaaN
Crypto Lab's great homomorphic encryption library
Ciphertext.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 "HEaaN/Context.hpp"
14 #include "HEaaN/HEaaNExport.hpp"
15 #include "HEaaN/Pointer.hpp"
16 #include "HEaaN/Real.hpp"
17 #include "HEaaN/device/Device.hpp"
18 
19 namespace HEaaN {
20 class CiphertextImpl;
21 class Polynomial;
22 
28  friend class BootstrapperImpl;
29 
30 public:
31  explicit Ciphertext(const Context &context, bool is_extended = false);
32 
33  ParameterPreset getParameterPreset() const;
34 
36  u64 getSize() const;
37 
40  void setSize(u64 size);
41 
44  void setLogSlots(u64 log_slots);
45 
48  u64 getLogSlots() const;
49  u64 getNumberOfSlots() const;
50 
52  u64 getCurrentPrime() const;
53 
55  Real getCurrentScaleFactor() const;
56 
58  Polynomial &getPoly(u64 i);
60  const Polynomial &getPoly(u64 i) const;
64  u64 *getPolyData(u64 i, u64 level) const;
65 
67  bool isModUp() const;
68 
70  void save(const std::string &path) const;
71 
73  void save(std::ostream &stream) const;
74 
76  void load(const std::string &path);
77 
79  void load(std::istream &stream);
80 
83  int getRescaleCounter() const;
84 
86  void setRescaleCounter(int r_counter);
87 
90  u64 getLevel() const;
91 
94  void setLevel(u64 level);
95 
98  const Device &getDevice() const;
99 
102  void to(const Device &device);
103 
106  void allocate(const Device &device);
107 
108 private:
110 
114  explicit Ciphertext(const Context &context, const Ciphertext &ctxt);
115 };
116 
117 } // namespace HEaaN
HEaaN::load
HEAAN_API void load(EvaluationKey &key, std::istream &stream)
Load key from a given stream.
HEaaN::Pointer< CiphertextImpl >
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
Pointer.hpp
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::Ciphertext::impl_
Pointer< CiphertextImpl > impl_
Definition: Ciphertext.hpp:109
HEaaN::Context
std::shared_ptr< ContextContent > Context
Definition: Context.hpp:27
HEaaN::Real
double Real
Default type for representing a real number.
Definition: Real.hpp:19
HEaaN::save
HEAAN_API void save(const EvaluationKey &key, std::ostream &stream)
Save key to a given stream.
Context.hpp
HEaaNExport.hpp
HEAAN_API
#define HEAAN_API
Definition: HEaaNExport.hpp:26
HEaaN
Definition: Bootstrapper.hpp:16
Real.hpp