Fix BFV packed encoding when t - 1 > q_0/2
Nov 30 find · published Nov 24GHGitHub · openfheorg/openfhe-development · 1 min readRead original
BFV scheme fixGitHub pull requestOpenFHE development
Pull request #1427 fixes BFV PackedEncoding that caused wrong decryption in every slot when plaintext modulus t - 1 exceeds half the first RNS limb modulus q_0. PackedEncoding::Encode stores packed coefficients in the first limb and fills other limbs using a centred modulus switch, which interprets values above floor(q_0/2) as negative. For t - 1 > floor(q_0/2), the limbs represent different integers, breaking encryption, addition and multiplication with plaintexts. This is reachable with small ScalingModSize like 21. The fix fills each limb with x mod q_j instead, preserving correctness for all parameter ranges. Unit tests verify the fix with t = 1179649 and t = 2752513.
21ScalingModSize triggering bug
1179649Test plaintext modulus
Comments
Sign in to join the conversation.