Skip to content

Support various NTT#12

Merged
juny2400 merged 4 commits into
mainfrom
support-various-NTT
May 29, 2026
Merged

Support various NTT#12
juny2400 merged 4 commits into
mainfrom
support-various-NTT

Conversation

@juny2400
Copy link
Copy Markdown
Contributor

@juny2400 juny2400 commented May 27, 2026

Support various NTT types (negacyclic & cyclic)

Summary

Refactors the single negacyclic NTT into a pluggable class hierarchy that supports multiple transform types, adds a hem(HEAAN)-compatible
cyclic NTT, and introduces a real-encryption path built on it.

Changes

  • NTT class hierarchy (NTT.hpp/.cpp): introduces abstract NTT_base with two concrete implementations — NTT (negacyclic, prime ≡ 1
    mod 2N) and NTT_C (cyclic / hem-compatible, prime ≡ 1 mod 4N, lands on the same NTT-domain bins as hem). Adds a runtime makeNTT()
    factory.
  • New NTTConfig module (NTTConfig.hpp/.cpp): NTTType (NONNTT / NEGACYCLIC / CYCLIC) and NTTRootType (MIN / DIRECT / CUSTOM) enums, a
    global root-type setting with a ScopedNTTRootType RAII guard, and registerCustomPsi() for user-supplied primitive roots.
  • Pluggable custom NTT: setNTTFactory() / createNTT() let callers register a custom backend (e.g. SIMD/HW-accelerated) that's picked up
    everywhere internally, with fallback to the default for combinations the factory doesn't handle.
  • NTT metadata propagation: CKKSTypes, Encryptor, SecretKeyGenerator, etc. now record and forward the NTT type & root type.
  • Real-encryption path: adds EncryptOptions::RealEncrypt() (cyclic-NTT based real-valued encryption), a new
    examples/EnDecryption-Real.cpp, and expanded EnDecryption-test.cpp / NTT-test.cpp coverage.

@juny2400 juny2400 marked this pull request as ready for review May 27, 2026 07:48
@juny2400 juny2400 requested a review from a team May 27, 2026 07:48
Comment thread CMakeLists.txt Outdated
Comment thread examples/EnDecryption-Real.cpp Outdated
@juny2400 juny2400 merged commit 6777c88 into main May 29, 2026
4 checks passed
@juny2400 juny2400 deleted the support-various-NTT branch May 29, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants