Skip to content

Commit

Permalink
Add more APIs to PredefinedRlweParameters (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
fboemer authored Aug 28, 2024
1 parent a10ab48 commit 59830d5
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 231 deletions.
12 changes: 7 additions & 5 deletions Snippets/HomomorphicEncryption/MultiplicationSnippet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@

import HomomorphicEncryption

// For this example, we make use of SIMD encoding. In SIMD format, addition and
// multiplication are performed element-wise on the encoded values. By contrast,
// in coefficient format, addition is element-wise, but multiplication is a
// negacyclic convolution of coefficients.
precondition(PredefinedRlweParameters.insecure_n_8_logq_5x18_logt_5
.supportsSimdEncoding)

// We start by choosing some encryption parameters for the Bfv<UInt32> scheme.
// When all the coefficient moduli are small enough, using UInt32 can yield
// significant speedups compared to UInt64.
Expand All @@ -29,11 +36,6 @@ precondition(encryptParams.plaintextModulus == 17)
// Perform pre-computation for HE computation with these parameters.
let context = try Context(encryptionParameters: encryptParams)

// For this example, we make use of SIMD encoding. In SIMD format, addition and
// multiplication are performed element-wise on the encoded values. By contrast,
// in coefficient format, addition is element-wise, but multiplication is a
// negacyclic convolution of coefficients.
precondition(encryptParams.supportsSimdEncoding)
// We don't need to use all the slots in the encoding.
// However, performing HE operations on ciphertexts with fewer slots doesn't give
// any runtime savings.
Expand Down
Loading

0 comments on commit 59830d5

Please sign in to comment.