Browse Source

Adding new functions

Hovsep Papoyan 7 months ago
parent
commit
d8372924ea
3 changed files with 12 additions and 1 deletions
  1. 8 0
      src/CryptoContext.cc
  2. 2 0
      src/CryptoContext.h
  3. 2 1
      src/lib.rs

+ 8 - 0
src/CryptoContext.cc

@@ -772,6 +772,14 @@ void CryptoContextDCRTPoly::EvalSchemeSwitchingKeyGen(const KeyPairDCRTPoly& key
     m_cryptoContextImplSharedPtr->EvalSchemeSwitchingKeyGen({keyPair.GetPublicKey(),
         keyPair.GetPrivateKey()}, lwesk.GetInternal());
 }
+uint64_t CryptoContextDCRTPoly::GetModulus() const
+{
+    return m_cryptoContextImplSharedPtr->GetModulus().ConvertToInt();
+}
+uint64_t CryptoContextDCRTPoly::GetRootOfUnity() const
+{
+    return m_cryptoContextImplSharedPtr->GetRootOfUnity().ConvertToInt();
+}
 std::shared_ptr<CryptoContextImpl> CryptoContextDCRTPoly::GetInternal() const
 {
     return m_cryptoContextImplSharedPtr;

+ 2 - 0
src/CryptoContext.h

@@ -327,6 +327,8 @@ public:
         const uint32_t dim1 /* 0 */, const uint32_t L /* 0 */) const;
     void EvalSchemeSwitchingKeyGen(const KeyPairDCRTPoly& keyPair,
         const LWEPrivateKey& lwesk) const;
+    [[nodiscard]] uint64_t GetModulus() const;
+    [[nodiscard]] uint64_t GetRootOfUnity() const;
     [[nodiscard]] std::shared_ptr<CryptoContextImpl> GetInternal() const;
 };
 // cxx currently does not support static class methods

+ 2 - 1
src/lib.rs

@@ -830,7 +830,6 @@ pub mod ffi
                                 -> UniquePtr<EvalKeyDCRTPoly>;
         fn EvalSumKeyGen(self: &CryptoContextDCRTPoly, privateKey: SharedPtr<PrivateKeyImpl>,
                          publicKey: /* null() */ SharedPtr<PublicKeyImpl>);
-
         fn EvalCKKStoFHEWKeyGen(self: &CryptoContextDCRTPoly, keyPair: &KeyPairDCRTPoly,
                                 lwesk: &LWEPrivateKey);
         fn EvalFHEWtoCKKSKeyGen(self: &CryptoContextDCRTPoly, keyPair: &KeyPairDCRTPoly,
@@ -838,6 +837,8 @@ pub mod ffi
                                 numCtxts: /* 0 */ u32, dim1: /* 0 */ u32, L: /* 0 */ u32);
         fn EvalSchemeSwitchingKeyGen(self: &CryptoContextDCRTPoly, keyPair: &KeyPairDCRTPoly,
                                      lwesk: &LWEPrivateKey);
+        fn GetModulus(self: &CryptoContextDCRTPoly) -> u64;
+        fn GetRootOfUnity(self: &CryptoContextDCRTPoly) -> u64;
 
         // cxx currently does not support static class methods
         fn ClearEvalMultKeys();