【问题标题】:Operations for rotations in ciphertext using SEAL使用 SEAL 进行密文旋转的操作
【发布时间】:2021-10-30 18:35:01
【问题描述】:

只是想知道我们是否可以对旋转的密文执行一些操作,使得只有部分密文参与操作,而不是整个对象。 假设我们只希望 ct 的 slot_count/2 部分参与操作,而后一个 slot_count/2 应该保持原样。 任何想法如何去做? 我目前正在使用 BFV 方案

【问题讨论】:

  • 嗨南迪尼,欢迎来到 StackOverflow!您可能想提及您正在使用的方案 (BFV/CKKS)。
  • 嗨,亚历山大,非常感谢您的回答!我已经编辑了我的问题。并且我现在正在使用 BFV 方案

标签: seal


【解决方案1】:

由于我们无法真正选择将旋转哪些插槽,因此实现此目的的一般方法更多是一种解决方法:

给定seal::Ciphertext xint steps 和适当的评估器/编码器和Seal Rotation Example (including Explanations) 中的密钥,我们可以执行以下操作:

  1. 复制 x seal::Ciphertext copy = x;
  2. 旋转副本 evaluator.rotate_vector_inplace(copy, steps, galoisKeys);(假设您使用的是 CKKS 方案)
  3. 与掩码相乘(在槽中为 0 或 1 的明文)
std::vector<unsigned long int> mask = {1,1,1,1,1,0,0,0,0 /*...*/};
seal::Plaintext mask_ptxt;
encoder.encode(mask, mask_ptxt);
evaluator.multiply_plain_inplace(copy, mask_ptxt);
  1. 将原版与反向蒙版相乘
 std::vector<unsigned long int> inv_mask = {0,0,0,0,0,1,1,1,1 /*...*/};
 seal::Plaintext inv_mask_ptxt;
 encoder.encode(inv_mask , inv_mask_ptxt);
 evaluator.multiply_plain_inplace(x, mask_ptxt);
  1. 将原始密文与旋转密文相加evaluator.add_inplace(x,copy);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-29
    • 2022-01-14
    • 1970-01-01
    相关资源
    最近更新 更多