Browse Source

Bug noise amplifier was zeroed (#38)

* Mod README.txt to remember setting the DYLD_LIBRARY_PATH which is the problem that keeps me spending too much time starting again on XPIR/OSX

* Enormous bug, the noise in b (2Berr-1) was zeroed. Fixed. Need to confirm that A_bit_mod=2^A_bits mod modulus, i.e. tmpz2 was meant to be tmpz1, anyway the code made no sense at all.
Kirija 6 years ago
parent
commit
8f6acae0e6
2 changed files with 2 additions and 3 deletions
  1. 0 1
      README.md
  2. 2 2
      crypto/NFLLWE.cpp

File diff suppressed because it is too large
+ 0 - 1
README.md


+ 2 - 2
crypto/NFLLWE.cpp

@@ -310,7 +310,7 @@ void  NFLLWE::enc(lwe_cipher *c, poly64 m)
 			//std::cout << std::hex << tmpb[i] << " " << std::dec;			
 				
 			tmpb[i] = nflInstance.mulmodShoup(tmpb[i], Abit_mod[currentModulus],Abit_mod_shoup[currentModulus], moduli[currentModulus]);
-      
+			
 			// and shifted to be in [-(Berr-1) .. (Berr-1)]
 			//tmpb[i] += moduli[currentModulus]-((Berr-1)<<A_bits);   
 
@@ -593,7 +593,7 @@ void NFLLWE::recomputeNoiseAmplifiers() {
 	mpz_init(tmpz1);
 	mpz_init(tmpz2);
 	for(unsigned short currentModulus=0;currentModulus<nbModuli;currentModulus++) {
-		mpz_ui_pow_ui(tmpz2, 2, A_bits);
+		mpz_ui_pow_ui(tmpz1, 2, A_bits);
 		mpz_import(tmpz2, 1, 1, sizeof(uint64_t), 0, 0, moduli+currentModulus);
 		mpz_mod(tmpz1, tmpz1, tmpz2);
 		Abit_mod[currentModulus]=0;

Some files were not shown because too many files changed in this diff