Browse Source

corrected the shake version for encaps and decaps

Gustavo Banegas 1 year ago
parent
commit
a28d7b7e5b
2 changed files with 21 additions and 21 deletions
  1. 13 13
      src/decapsulation.c
  2. 8 8
      src/encapsulation.c

+ 13 - 13
src/decapsulation.c

@@ -72,13 +72,13 @@ int decrypt(unsigned char *secret_shared, const unsigned char *cipher_text,
 	 */
 
 	// Compute d1 = H(m1) where H is  sponge SHA-512 function
-#if defined(DAGS_3) || defined(DAGS_5)
+//#if defined(DAGS_3) || defined(DAGS_5)
 	shake256(r1, code_dimension, m1, k_prime);
 	shake256(d1, k_prime, m1, k_prime);
-#else 
-	shake128(r1, code_dimension, m1, k_prime);
-	shake128(d1, k_prime, m1, k_prime);
-#endif
+//#else
+	//shake128(r1, code_dimension, m1, k_prime);
+	//shake128(d1, k_prime, m1, k_prime);
+//#endif
 
 	for (i = 0; i < k_prime; i++) {
 		d1[i] = d1[i] & (F_q_size - 1);
@@ -112,11 +112,11 @@ int decrypt(unsigned char *secret_shared, const unsigned char *cipher_text,
 
 	//test = KangarooTwelve(sigma, k_prime, hash_sigma, code_length, K12_custom, K12_custom_len);
 	//SHAKE256(hash_sigma, code_length, sigma, k_prime);
-#if defined(DAGS_3) || defined(DAGS_5)
+//#if defined(DAGS_3) || defined(DAGS_5)
 	shake256(hash_sigma, code_length, sigma, k_prime);
-#else
-	shake128(hash_sigma, code_length, sigma, k_prime);
-#endif 
+//#else
+	//shake128(hash_sigma, code_length, sigma, k_prime);
+//#endif
 
 	//Generate error vector e2 of length code_length and weight n0_w from
 	//hash_sigma1 by using random_e function.
@@ -135,11 +135,11 @@ int decrypt(unsigned char *secret_shared, const unsigned char *cipher_text,
 	 */
 	//test = KangarooTwelve(m1, k_prime, ss, ss_length, K12_custom, K12_custom_len);
 	//SHAKE256(secret_shared, ss_length, m1, k_prime);
-#if defined(DAGS_3) || defined(DAGS_5)
+//#if defined(DAGS_3) || defined(DAGS_5)
 	shake256(hash_sigma, code_length, sigma, k_prime);
-#else
-	shake128(hash_sigma, code_length, sigma, k_prime);
-#endif
+//#else
+	//shake128(hash_sigma, code_length, sigma, k_prime);
+//#endif
 
 	return 0;
 }

+ 8 - 8
src/encapsulation.c

@@ -85,11 +85,11 @@ int encrypt(unsigned char *ciphert_text, unsigned char *secret_shared,
 	memcpy(&u[k_sec], m, code_dimension - k_sec);
 
 	PRINT_DEBUG_ENCAP("Generating error_array: \n");
-#if defined(DAGS_3) || defined(DAGS_5)
+//#if defined(DAGS_3) || defined(DAGS_5)
 	shake256(hash_sigma, code_length, sigma, k_prime);
-#else
-	shake128(hash_sigma, code_length, sigma, k_prime);
-#endif
+//#else
+	//shake128(hash_sigma, code_length, sigma, k_prime);
+//#endif
 	
 	random_e(hash_sigma, error_array);
 
@@ -119,11 +119,11 @@ int encrypt(unsigned char *ciphert_text, unsigned char *secret_shared,
 	PRINT_DEBUG_ENCAP("|\nHashing (m*G) + error: \n");
 #endif
 
-#if defined(DAGS_3) || defined(DAGS_5)
+//#if defined(DAGS_3) || defined(DAGS_5)
 	shake256(K, ss_length, m, k_prime);
-#else
-	shake128(K, ss_length, m, k_prime);
-#endif
+//#else
+	//shake128(K, ss_length, m, k_prime);
+//#endif
 
 	memcpy(secret_shared, K, ss_length);
 	return EXIT_SUCCESS;