Closed jeffmur closed 8 months ago
https://github.com/microsoft/SEAL/blob/main/native/examples/3_levels.cpp
[ RUN ] Basics.Levels / | Encryption parameters: | scheme: BFV | poly_modulus_degree: 8192 | coeff_modulus size: 5 (43 + 43 + 44 + 44 + 44) bits | plain_modulus: 1032193 \ Line 94 --> Print the modulus switching chain. ----> Level (chain index): 4 ...... key_context_data() parms_id: f9ece899e98dc76c 461b0a7748fa8c61 88e468603ecbbd8e 75feb3e1288c08b8 coeff_modulus primes: 7fffffd8001 7fffffc8001 fffffffc001 ffffff6c001 fffffebc001 \ \--> Level (chain index): 3 ...... first_context_data() parms_id: 23ae23fc1ed2a1b6 90ae48e187641b71 d7611ddf0056f6a7 d4ce43eef038575f coeff_modulus primes: 7fffffd8001 7fffffc8001 fffffffc001 ffffff6c001 \ \--> Level (chain index): 2 parms_id: 783297d2e7d9b749 80e40178a3bd9991 e84fed758f28b19a 2192abbc157b996a coeff_modulus primes: 7fffffd8001 7fffffc8001 fffffffc001 \ \--> Level (chain index): 1 parms_id: 748291d211394e8e 28b3a2963de475b0 382acfd0e00205b5 bab66082d91dc08a coeff_modulus primes: 7fffffd8001 7fffffc8001 \ \--> Level (chain index): 0 ...... last_context_data() parms_id: 8b59c1c982f0a72d bce1ddc82ae8dc9f 68952fcaa638d78a b80046009fe3e881 coeff_modulus primes: 7fffffd8001 \ \--> End of chain reached Line 171 --> Print the parameter IDs of generated elements. + public_key: f9ece899e98dc76c 461b0a7748fa8c61 88e468603ecbbd8e 75feb3e1288c08b8 + secret_key: f9ece899e98dc76c 461b0a7748fa8c61 88e468603ecbbd8e 75feb3e1288c08b8 + relin_keys: f9ece899e98dc76c 461b0a7748fa8c61 88e468603ecbbd8e 75feb3e1288c08b8 + plain: 0 0 0 0 (not set in BFV) + encrypted: 23ae23fc1ed2a1b6 90ae48e187641b71 d7611ddf0056f6a7 d4ce43eef038575f Line 219 --> Perform modulus switching on encrypted and print. ----> Level (chain index): 3 parms_id of encrypted: 23ae23fc1ed2a1b6 90ae48e187641b71 d7611ddf0056f6a7 d4ce43eef038575f Noise budget at this level: 146 bits \ \--> Level (chain index): 2 parms_id of encrypted: 783297d2e7d9b749 80e40178a3bd9991 e84fed758f28b19a 2192abbc157b996a Noise budget at this level: 102 bits \ \--> Level (chain index): 1 parms_id of encrypted: 748291d211394e8e 28b3a2963de475b0 382acfd0e00205b5 bab66082d91dc08a Noise budget at this level: 58 bits \ \--> Level (chain index): 0 parms_id of encrypted: 8b59c1c982f0a72d bce1ddc82ae8dc9f 68952fcaa638d78a b80046009fe3e881 Noise budget at this level: 15 bits \ \--> End of chain reached Line 255 --> Decrypt still works after modulus switching. + Decryption of encrypted: 1x^3 + 2x^2 + 3x^1 + 4 ...... Correct. Computation is more efficient with modulus switching. Line 276 --> Compute the 8th power. + Noise budget fresh: 146 bits + Noise budget of the 2nd power: 114 bits + Noise budget of the 4th power: 81 bits + Noise budget after modulus switching: 81 bits + Noise budget of the 8th power: 48 bits + Noise budget after modulus switching: 48 bits + Decryption of the 8th power (hexadecimal) 1x^24 + 10x^23 + 88x^22 + 330x^21 + EFCx^20 + 3A30x^19 + C0B8x^18 + 22BB0x^17 + 58666x^16 + C88D0x^15 + 9C377x^14 + F4C0Ex^13 + E8B38x^12 + 5EE89x^11 + F8BFFx^10 + 30304x^9 + 5B9D4x^8 + 12653x^7 + 4DFB5x^6 + 879F8x^5 + 825FBx^4 + F1FFEx^3 + 3FFFFx^2 + 60000x^1 + 10000 ...... Correct. Line 332 --> Disable modulus switching chain. Optionally disable modulus switching chain expansion. ----> Level (chain index): 1 parms_id: f9ece899e98dc76c 461b0a7748fa8c61 88e468603ecbbd8e 75feb3e1288c08b8 coeff_modulus primes: 7fffffd8001 7fffffc8001 fffffffc001 ffffff6c001 fffffebc001 \ \--> Level (chain index): 0 parms_id: 23ae23fc1ed2a1b6 90ae48e187641b71 d7611ddf0056f6a7 d4ce43eef038575f coeff_modulus primes: 7fffffd8001 7fffffc8001 fffffffc001 ffffff6c001 \ \--> End of chain reached [ OK ] Basics.Levels (1891 ms)
https://github.com/microsoft/SEAL/blob/main/native/examples/3_levels.cpp