diff --git a/circom_circuits/hash/poseidon/poseidon_16_to_1_Jubjub.circom b/circom_circuits/hash/poseidon/poseidon_16_to_1_Jubjub.circom index 02a7912..556b41b 100644 --- a/circom_circuits/hash/poseidon/poseidon_16_to_1_Jubjub.circom +++ b/circom_circuits/hash/poseidon/poseidon_16_to_1_Jubjub.circom @@ -467,22 +467,7 @@ template hash_16_to_1(){ perm.in[i] <== in[i]; } - out <== in[0] + perm.out[0] + - in[1] + perm.out[1] + - in[2] + perm.out[2] + - in[3] + perm.out[3] + - in[4] + perm.out[4] + - in[5] + perm.out[5] + - in[6] + perm.out[6] + - in[7] + perm.out[7] + - in[8] + perm.out[8] + - in[9] + perm.out[9] + - in[10] + perm.out[10] + - in[11] + perm.out[11] + - in[12] + perm.out[12] + - in[13] + perm.out[13] + - in[14] + perm.out[14] + - in[15] + perm.out[15]; + out <== in[0] + perm.out[0]; } //component main = hash_16_to_1(); \ No newline at end of file diff --git a/circom_circuits/hash/poseidon/poseidon_2_to_1_Jubjub.circom b/circom_circuits/hash/poseidon/poseidon_2_to_1_Jubjub.circom index 26e25dd..11de910 100644 --- a/circom_circuits/hash/poseidon/poseidon_2_to_1_Jubjub.circom +++ b/circom_circuits/hash/poseidon/poseidon_2_to_1_Jubjub.circom @@ -141,7 +141,7 @@ template hash_2_to_1(){ perm.in[0] <== in[0]; perm.in[1] <== in[1]; - out <== in[0] + perm.out[0] + in[1] + perm.out[1]; + out <== in[0] + perm.out[0]; } //component main = hash_2_to_1(); \ No newline at end of file diff --git a/circom_circuits/hash/poseidon/poseidon_4_to_1_Jubjub.circom b/circom_circuits/hash/poseidon/poseidon_4_to_1_Jubjub.circom index 9a67981..500bfd0 100644 --- a/circom_circuits/hash/poseidon/poseidon_4_to_1_Jubjub.circom +++ b/circom_circuits/hash/poseidon/poseidon_4_to_1_Jubjub.circom @@ -182,7 +182,7 @@ template hash_4_to_1(){ perm.in[2] <== in[2]; perm.in[3] <== in[3]; - out <== in[0] + perm.out[0] + in[1] + perm.out[1] + in[2] + perm.out[2] + in[3] + perm.out[3]; + out <== in[0] + perm.out[0]; } //component main = hash_4_to_1(); \ No newline at end of file diff --git a/proof_of_leadership/circom/generate_inputs.py b/proof_of_leadership/circom/generate_inputs.py index 0cfb01c..95aefe0 100755 --- a/proof_of_leadership/circom/generate_inputs.py +++ b/proof_of_leadership/circom/generate_inputs.py @@ -450,7 +450,7 @@ def poseidon(state): state[j] += cst[64 + i*2 + j] state[j] = state[j]**5 state = poseidon_linear_layer_2_to_1(state) - return state[0] + state[1] + original_state[0] + original_state[1] + return state[0] + original_state[0] if len(state) == 4: original_state = state cst = poseidon_round_constant_4_to_1() @@ -469,10 +469,7 @@ def poseidon(state): state[j] += cst[72 + i*4 + j] state[j] = state[j]**5 state = poseidon_external_linear_layer_4_to_1(state) - h = F(0) - for i in range(4): - h += state[i] + original_state[i] - return h + return state[0] + original_state[0] if len(state) == 16: original_state = state cst = poseidon_round_constant_16_to_1() @@ -491,10 +488,7 @@ def poseidon(state): state[j] += cst[121 + i*16 + j] state[j] = state[j]**5 state = poseidon_external_linear_layer_16_to_1(state) - h = F(0) - for i in range(16): - h += state[i] + original_state[i] - return h + return state[0] + original_state[0] def poseidon_linear_layer_2_to_1(state): M = Matrix(F,[[2,1],[1,2]])