kaist-plrg / fhetest

2 stars 1 forks source link

Example of SEAL whose result is different depending on the multiplicative depth #17

Closed hyerinshelly closed 8 months ago

hyerinshelly commented 8 months ago

Running the below example t2 program (including 4 multiplications) with SEAL returns the output with d=7, but throws an exception. Details are here:

Example T2 Program

int main(void) {
  EncDouble x, y; double yP; int c; 
  x = {84.002601,67.078888,8.049681,41.153198,67.702231,58.548482,83.484551,47.499139,47.332666,45.850745,5.555324,27.824130,38.085573,67.124150,93.112555,60.148085,34.173879,78.527918,58.863022,47.586321,24.483015,58.549139,31.589364,27.400489,57.056091,54.766420,25.026209,19.657221,58.141173,38.588261,59.365120,31.647444,53.423337,82.410106,28.567664,40.957616,96.583693,63.184848,59.497953,77.447351,83.472151,26.577298,27.343043,12.376304,18.950177,16.673949,75.871623,41.536313,7.854370,87.645116,40.788412,18.483241,61.551165,65.807327,89.773758,53.826079,47.197567,23.209647,73.754957,47.019311,58.092296,57.168329,30.537804,58.217667,50.396249,44.100064,94.133977,59.490829,74.020807,50.554777,40.951833,27.058778,23.626904,39.524812,47.475274,49.196900,49.447444,5.908005};
  c = 1;
  rotate_left(x, c);
  yP = 31.139577;
  match_params(x, x);
  x *= yP;
  reduce_noise(x);
  c = 5;
  rotate_left(x, c);
  y = {64.582651,83.361180,73.267462,19.603254,70.594373,79.005992,68.313443,61.367217,43.291110,92.605003,76.849022,33.604855,76.842873,75.632949,57.624570,29.118542,58.295601,42.937520,5.779961,2.132533,20.849896,79.318885,56.018828,46.446558,91.926691,53.277885,90.300288,12.619961,57.653750,92.306076,54.543364,43.999015,44.410845,19.500933,6.905739,58.372688,0.200292,24.824707,91.389924,27.139804,43.863515,45.985577,54.846273,7.093160,38.543155,63.704868,2.883713,61.273907,37.294167,74.044322,20.765463,64.822007,43.376256,86.502481,69.058434,29.346432,25.513912,10.749499,0.621356,95.061219,29.289197};
  match_params(y, x);
  x -= y;
  y = {9.572880,98.342230,72.397550,94.058984,34.717898,27.473080,30.837667,95.919262,59.506984,90.775647,28.056093,52.705349,52.389868,67.807880,28.406662,31.439420,37.779308,59.087397,0.442961,92.845778,99.780777,19.470929,16.903743,46.254952,45.417424,46.397245,65.800378,91.361335,32.443656,96.861273,30.287548,67.430603,50.922789,85.600623,99.393069,41.979094,97.451213,86.213725};
  match_params(y, x);
  x *= y;
  reduce_noise(x);
  yP = 91.702111;
  match_params(x, x);
  x *= yP;
  reduce_noise(x);
  c = 8;
  rotate_left(x, c);
  y = {96.243511,16.792358,9.735731,71.470605,2.250091,42.139402,94.033078,24.233465,68.060838,65.756062,12.841246,11.154275,68.555365,16.521023,5.836204,65.154898,55.092482,57.347332,98.442785,78.779859,54.488479,56.091034,17.091322,56.813372,37.115939,62.598879,65.142895,50.873137,53.161716,30.020754,64.234861,38.960084,76.414877,3.375688,26.442729,30.618934,0.912300,73.848615,98.924054,36.665264,7.351761,63.408370,14.604528,41.360588,53.389312,61.075628,89.985964,54.467650,44.769817,79.532803,34.300460,0.793998,12.696499,38.756233,73.004444,25.632642,56.927469,11.964196,43.000991,55.934383,13.794110,88.412626,86.998168,59.097205,73.668370,17.433704,60.055852,83.933865,3.362909,98.600690,62.642850,51.679654,25.530166,74.015735,31.420790,88.828006,69.333449,60.455669,51.490768,58.132485,34.495076,31.474004,1.983163,49.289432,4.283777,22.545707,10.640749,36.616315,2.085477};
  match_params(y, x);
  x *= y;
  reduce_noise(x); 
  print_batched (x, 20); 
  return 0;
} 

Result of SEAL

hyerinshelly commented 8 months ago

After re-building T2, it has been solved.