diff --git a/packages/circom/circuits/common/from_addr_regex.circom b/packages/circom/circuits/common/from_addr_regex.circom index f95e7ad..fb1785b 100644 --- a/packages/circom/circuits/common/from_addr_regex.circom +++ b/packages/circom/circuits/common/from_addr_regex.circom @@ -13,20 +13,20 @@ template FromAddrRegex(msg_bytes) { in[i+1] <== msg[i]; } - component eq[61][num_bytes]; - component lt[54][num_bytes]; - component and[65][num_bytes]; - component multi_or[23][num_bytes]; - signal states[num_bytes+1][19]; + component eq[38][num_bytes]; + component lt[36][num_bytes]; + component and[40][num_bytes]; + component multi_or[13][num_bytes]; + signal states[num_bytes+1][16]; component state_changed[num_bytes]; states[0][0] <== 1; - for (var i = 1; i < 19; i++) { + for (var i = 1; i < 16; i++) { states[0][i] <== 0; } for (var i = 0; i < num_bytes; i++) { - state_changed[i] = MultiOR(18); + state_changed[i] = MultiOR(15); lt[0][i] = LessThan(8); lt[0][i].in[0] <== 47; lt[0][i].in[1] <== in[i]; @@ -56,18 +56,22 @@ template FromAddrRegex(msg_bytes) { and[2][i].b <== lt[5][i].out; eq[0][i] = IsEqual(); eq[0][i].in[0] <== in[i]; - eq[0][i].in[1] <== 46; + eq[0][i].in[1] <== 45; eq[1][i] = IsEqual(); eq[1][i].in[0] <== in[i]; - eq[1][i].in[1] <== 95; + eq[1][i].in[1] <== 46; + eq[2][i] = IsEqual(); + eq[2][i].in[0] <== in[i]; + eq[2][i].in[1] <== 95; and[3][i] = AND(); and[3][i].a <== states[i][1]; - multi_or[0][i] = MultiOR(5); + multi_or[0][i] = MultiOR(6); multi_or[0][i].in[0] <== and[0][i].out; multi_or[0][i].in[1] <== and[1][i].out; multi_or[0][i].in[2] <== and[2][i].out; multi_or[0][i].in[3] <== eq[0][i].out; multi_or[0][i].in[4] <== eq[1][i].out; + multi_or[0][i].in[5] <== eq[2][i].out; and[3][i].b <== multi_or[0][i].out; lt[6][i] = LessThan(8); lt[6][i].in[0] <== 47; @@ -96,664 +100,402 @@ template FromAddrRegex(msg_bytes) { and[6][i] = AND(); and[6][i].a <== lt[10][i].out; and[6][i].b <== lt[11][i].out; - eq[2][i] = IsEqual(); - eq[2][i].in[0] <== in[i]; - eq[2][i].in[1] <== 46; eq[3][i] = IsEqual(); eq[3][i].in[0] <== in[i]; - eq[3][i].in[1] <== 95; + eq[3][i].in[1] <== 45; + eq[4][i] = IsEqual(); + eq[4][i].in[0] <== in[i]; + eq[4][i].in[1] <== 46; + eq[5][i] = IsEqual(); + eq[5][i].in[0] <== in[i]; + eq[5][i].in[1] <== 95; and[7][i] = AND(); - and[7][i].a <== states[i][13]; - multi_or[1][i] = MultiOR(5); + and[7][i].a <== states[i][5]; + multi_or[1][i] = MultiOR(6); multi_or[1][i].in[0] <== and[4][i].out; multi_or[1][i].in[1] <== and[5][i].out; multi_or[1][i].in[2] <== and[6][i].out; - multi_or[1][i].in[3] <== eq[2][i].out; - multi_or[1][i].in[4] <== eq[3][i].out; + multi_or[1][i].in[3] <== eq[3][i].out; + multi_or[1][i].in[4] <== eq[4][i].out; + multi_or[1][i].in[5] <== eq[5][i].out; and[7][i].b <== multi_or[1][i].out; - multi_or[2][i] = MultiOR(2); - multi_or[2][i].in[0] <== and[3][i].out; - multi_or[2][i].in[1] <== and[7][i].out; - states[i+1][1] <== multi_or[2][i].out; - state_changed[i].in[0] <== states[i+1][1]; - eq[4][i] = IsEqual(); - eq[4][i].in[0] <== in[i]; - eq[4][i].in[1] <== 13; - and[8][i] = AND(); - and[8][i].a <== states[i][0]; - and[8][i].b <== eq[4][i].out; - eq[5][i] = IsEqual(); - eq[5][i].in[0] <== in[i]; - eq[5][i].in[1] <== 13; - and[9][i] = AND(); - and[9][i].a <== states[i][4]; - and[9][i].b <== eq[5][i].out; - multi_or[3][i] = MultiOR(2); - multi_or[3][i].in[0] <== and[8][i].out; - multi_or[3][i].in[1] <== and[9][i].out; - states[i+1][2] <== multi_or[3][i].out; - state_changed[i].in[1] <== states[i+1][2]; - eq[6][i] = IsEqual(); - eq[6][i].in[0] <== in[i]; - eq[6][i].in[1] <== 32; - eq[7][i] = IsEqual(); - eq[7][i].in[0] <== in[i]; - eq[7][i].in[1] <== 34; - and[10][i] = AND(); - and[10][i].a <== states[i][1]; - multi_or[4][i] = MultiOR(2); - multi_or[4][i].in[0] <== eq[6][i].out; - multi_or[4][i].in[1] <== eq[7][i].out; - and[10][i].b <== multi_or[4][i].out; lt[12][i] = LessThan(8); lt[12][i].in[0] <== 47; lt[12][i].in[1] <== in[i]; lt[13][i] = LessThan(8); lt[13][i].in[0] <== in[i]; lt[13][i].in[1] <== 58; - and[11][i] = AND(); - and[11][i].a <== lt[12][i].out; - and[11][i].b <== lt[13][i].out; + and[8][i] = AND(); + and[8][i].a <== lt[12][i].out; + and[8][i].b <== lt[13][i].out; lt[14][i] = LessThan(8); lt[14][i].in[0] <== 64; lt[14][i].in[1] <== in[i]; lt[15][i] = LessThan(8); lt[15][i].in[0] <== in[i]; lt[15][i].in[1] <== 91; - and[12][i] = AND(); - and[12][i].a <== lt[14][i].out; - and[12][i].b <== lt[15][i].out; + and[9][i] = AND(); + and[9][i].a <== lt[14][i].out; + and[9][i].b <== lt[15][i].out; lt[16][i] = LessThan(8); lt[16][i].in[0] <== 96; lt[16][i].in[1] <== in[i]; lt[17][i] = LessThan(8); lt[17][i].in[0] <== in[i]; lt[17][i].in[1] <== 123; - and[13][i] = AND(); - and[13][i].a <== lt[16][i].out; - and[13][i].b <== lt[17][i].out; + and[10][i] = AND(); + and[10][i].a <== lt[16][i].out; + and[10][i].b <== lt[17][i].out; + eq[6][i] = IsEqual(); + eq[6][i].in[0] <== in[i]; + eq[6][i].in[1] <== 45; + eq[7][i] = IsEqual(); + eq[7][i].in[0] <== in[i]; + eq[7][i].in[1] <== 46; eq[8][i] = IsEqual(); eq[8][i].in[0] <== in[i]; - eq[8][i].in[1] <== 32; + eq[8][i].in[1] <== 95; + and[11][i] = AND(); + and[11][i].a <== states[i][14]; + multi_or[2][i] = MultiOR(6); + multi_or[2][i].in[0] <== and[8][i].out; + multi_or[2][i].in[1] <== and[9][i].out; + multi_or[2][i].in[2] <== and[10][i].out; + multi_or[2][i].in[3] <== eq[6][i].out; + multi_or[2][i].in[4] <== eq[7][i].out; + multi_or[2][i].in[5] <== eq[8][i].out; + and[11][i].b <== multi_or[2][i].out; + multi_or[3][i] = MultiOR(3); + multi_or[3][i].in[0] <== and[3][i].out; + multi_or[3][i].in[1] <== and[7][i].out; + multi_or[3][i].in[2] <== and[11][i].out; + states[i+1][1] <== multi_or[3][i].out; + state_changed[i].in[0] <== states[i+1][1]; + log("i: ",i, "in[i]: ",in[i], "states[i+1][1]", states[i+1][1]); eq[9][i] = IsEqual(); eq[9][i].in[0] <== in[i]; - eq[9][i].in[1] <== 34; + eq[9][i].in[1] <== 13; + and[12][i] = AND(); + and[12][i].a <== states[i][0]; + and[12][i].b <== eq[9][i].out; eq[10][i] = IsEqual(); eq[10][i].in[0] <== in[i]; - eq[10][i].in[1] <== 46; + eq[10][i].in[1] <== 13; + and[13][i] = AND(); + and[13][i].a <== states[i][4]; + and[13][i].b <== eq[10][i].out; + multi_or[4][i] = MultiOR(2); + multi_or[4][i].in[0] <== and[12][i].out; + multi_or[4][i].in[1] <== and[13][i].out; + states[i+1][2] <== multi_or[4][i].out; + state_changed[i].in[1] <== states[i+1][2]; eq[11][i] = IsEqual(); eq[11][i].in[0] <== in[i]; - eq[11][i].in[1] <== 64; + eq[11][i].in[1] <== 10; eq[12][i] = IsEqual(); eq[12][i].in[0] <== in[i]; - eq[12][i].in[1] <== 95; - and[14][i] = AND(); - and[14][i].a <== states[i][3]; - multi_or[5][i] = MultiOR(8); - multi_or[5][i].in[0] <== and[11][i].out; - multi_or[5][i].in[1] <== and[12][i].out; - multi_or[5][i].in[2] <== and[13][i].out; - multi_or[5][i].in[3] <== eq[8][i].out; - multi_or[5][i].in[4] <== eq[9][i].out; - multi_or[5][i].in[5] <== eq[10][i].out; - multi_or[5][i].in[6] <== eq[11][i].out; - multi_or[5][i].in[7] <== eq[12][i].out; - and[14][i].b <== multi_or[5][i].out; + eq[12][i].in[1] <== 13; eq[13][i] = IsEqual(); eq[13][i].in[0] <== in[i]; - eq[13][i].in[1] <== 32; + eq[13][i].in[1] <== 60; + and[14][i] = AND(); + and[14][i].a <== states[i][3]; + multi_or[5][i] = MultiOR(3); + multi_or[5][i].in[0] <== eq[11][i].out; + multi_or[5][i].in[1] <== eq[12][i].out; + multi_or[5][i].in[2] <== eq[13][i].out; + and[14][i].b <== 1 - multi_or[5][i].out; + lt[18][i] = LessThan(8); + lt[18][i].in[0] <== 47; + lt[18][i].in[1] <== in[i]; + lt[19][i] = LessThan(8); + lt[19][i].in[0] <== in[i]; + lt[19][i].in[1] <== 58; + and[15][i] = AND(); + and[15][i].a <== lt[18][i].out; + and[15][i].b <== lt[19][i].out; + lt[20][i] = LessThan(8); + lt[20][i].in[0] <== 64; + lt[20][i].in[1] <== in[i]; + lt[21][i] = LessThan(8); + lt[21][i].in[0] <== in[i]; + lt[21][i].in[1] <== 91; + and[16][i] = AND(); + and[16][i].a <== lt[20][i].out; + and[16][i].b <== lt[21][i].out; + lt[22][i] = LessThan(8); + lt[22][i].in[0] <== 96; + lt[22][i].in[1] <== in[i]; + lt[23][i] = LessThan(8); + lt[23][i].in[0] <== in[i]; + lt[23][i].in[1] <== 123; + and[17][i] = AND(); + and[17][i].a <== lt[22][i].out; + and[17][i].b <== lt[23][i].out; eq[14][i] = IsEqual(); eq[14][i].in[0] <== in[i]; - eq[14][i].in[1] <== 34; + eq[14][i].in[1] <== 10; eq[15][i] = IsEqual(); eq[15][i].in[0] <== in[i]; - eq[15][i].in[1] <== 64; - and[15][i] = AND(); - and[15][i].a <== states[i][12]; - multi_or[6][i] = MultiOR(3); - multi_or[6][i].in[0] <== eq[13][i].out; - multi_or[6][i].in[1] <== eq[14][i].out; - multi_or[6][i].in[2] <== eq[15][i].out; - and[15][i].b <== multi_or[6][i].out; + eq[15][i].in[1] <== 13; eq[16][i] = IsEqual(); eq[16][i].in[0] <== in[i]; - eq[16][i].in[1] <== 32; + eq[16][i].in[1] <== 45; eq[17][i] = IsEqual(); eq[17][i].in[0] <== in[i]; - eq[17][i].in[1] <== 34; + eq[17][i].in[1] <== 46; eq[18][i] = IsEqual(); eq[18][i].in[0] <== in[i]; - eq[18][i].in[1] <== 64; - and[16][i] = AND(); - and[16][i].a <== states[i][13]; - multi_or[7][i] = MultiOR(3); - multi_or[7][i].in[0] <== eq[16][i].out; - multi_or[7][i].in[1] <== eq[17][i].out; - multi_or[7][i].in[2] <== eq[18][i].out; - and[16][i].b <== multi_or[7][i].out; + eq[18][i].in[1] <== 95; + and[18][i] = AND(); + and[18][i].a <== states[i][14]; + multi_or[6][i] = MultiOR(8); + multi_or[6][i].in[0] <== and[15][i].out; + multi_or[6][i].in[1] <== and[16][i].out; + multi_or[6][i].in[2] <== and[17][i].out; + multi_or[6][i].in[3] <== eq[14][i].out; + multi_or[6][i].in[4] <== eq[15][i].out; + multi_or[6][i].in[5] <== eq[16][i].out; + multi_or[6][i].in[6] <== eq[17][i].out; + multi_or[6][i].in[7] <== eq[18][i].out; + and[18][i].b <== 1 - multi_or[6][i].out; + multi_or[7][i] = MultiOR(2); + multi_or[7][i].in[0] <== and[14][i].out; + multi_or[7][i].in[1] <== and[18][i].out; + states[i+1][3] <== multi_or[7][i].out; + log("i: ",i, "in[i]: ",in[i], "states[i+1][3]", states[i+1][3]); + state_changed[i].in[2] <== states[i+1][3]; eq[19][i] = IsEqual(); eq[19][i].in[0] <== in[i]; - eq[19][i].in[1] <== 32; + eq[19][i].in[1] <== 128; + and[19][i] = AND(); + and[19][i].a <== states[i][0]; + and[19][i].b <== eq[19][i].out; eq[20][i] = IsEqual(); eq[20][i].in[0] <== in[i]; - eq[20][i].in[1] <== 34; + eq[20][i].in[1] <== 10; + and[20][i] = AND(); + and[20][i].a <== states[i][2]; + and[20][i].b <== eq[20][i].out; + multi_or[8][i] = MultiOR(2); + multi_or[8][i].in[0] <== and[19][i].out; + multi_or[8][i].in[1] <== and[20][i].out; + states[i+1][4] <== multi_or[8][i].out; + state_changed[i].in[3] <== states[i+1][4]; eq[21][i] = IsEqual(); eq[21][i].in[0] <== in[i]; - eq[21][i].in[1] <== 64; - and[17][i] = AND(); - and[17][i].a <== states[i][15]; - multi_or[8][i] = MultiOR(3); - multi_or[8][i].in[0] <== eq[19][i].out; - multi_or[8][i].in[1] <== eq[20][i].out; - multi_or[8][i].in[2] <== eq[21][i].out; - and[17][i].b <== multi_or[8][i].out; - multi_or[9][i] = MultiOR(5); - multi_or[9][i].in[0] <== and[10][i].out; - multi_or[9][i].in[1] <== and[14][i].out; - multi_or[9][i].in[2] <== and[15][i].out; - multi_or[9][i].in[3] <== and[16][i].out; - multi_or[9][i].in[4] <== and[17][i].out; - states[i+1][3] <== multi_or[9][i].out; - state_changed[i].in[2] <== states[i+1][3]; + eq[21][i].in[1] <== 60; + and[21][i] = AND(); + and[21][i].a <== states[i][3]; + and[21][i].b <== eq[21][i].out; + states[i+1][5] <== and[21][i].out; + log("i: ",i, "in[i]: ",in[i], "states[i+1][5]", states[i+1][5]); + state_changed[i].in[4] <== states[i+1][5]; eq[22][i] = IsEqual(); eq[22][i].in[0] <== in[i]; - eq[22][i].in[1] <== 128; - and[18][i] = AND(); - and[18][i].a <== states[i][0]; - and[18][i].b <== eq[22][i].out; + eq[22][i].in[1] <== 64; + and[22][i] = AND(); + and[22][i].a <== states[i][1]; + and[22][i].b <== eq[22][i].out; + states[i+1][6] <== and[22][i].out; + state_changed[i].in[5] <== states[i+1][6]; eq[23][i] = IsEqual(); eq[23][i].in[0] <== in[i]; - eq[23][i].in[1] <== 10; - and[19][i] = AND(); - and[19][i].a <== states[i][2]; - and[19][i].b <== eq[23][i].out; - multi_or[10][i] = MultiOR(2); - multi_or[10][i].in[0] <== and[18][i].out; - multi_or[10][i].in[1] <== and[19][i].out; - states[i+1][4] <== multi_or[10][i].out; - state_changed[i].in[3] <== states[i+1][4]; - eq[24][i] = IsEqual(); - eq[24][i].in[0] <== in[i]; - eq[24][i].in[1] <== 60; - and[20][i] = AND(); - and[20][i].a <== states[i][1]; - and[20][i].b <== eq[24][i].out; - eq[25][i] = IsEqual(); - eq[25][i].in[0] <== in[i]; - eq[25][i].in[1] <== 60; - and[21][i] = AND(); - and[21][i].a <== states[i][3]; - and[21][i].b <== eq[25][i].out; - eq[26][i] = IsEqual(); - eq[26][i].in[0] <== in[i]; - eq[26][i].in[1] <== 60; - and[22][i] = AND(); - and[22][i].a <== states[i][12]; - and[22][i].b <== eq[26][i].out; - eq[27][i] = IsEqual(); - eq[27][i].in[0] <== in[i]; - eq[27][i].in[1] <== 60; + eq[23][i].in[1] <== 102; and[23][i] = AND(); - and[23][i].a <== states[i][15]; - and[23][i].b <== eq[27][i].out; - multi_or[11][i] = MultiOR(4); - multi_or[11][i].in[0] <== and[20][i].out; - multi_or[11][i].in[1] <== and[21][i].out; - multi_or[11][i].in[2] <== and[22][i].out; - multi_or[11][i].in[3] <== and[23][i].out; - states[i+1][5] <== multi_or[11][i].out; - state_changed[i].in[4] <== states[i+1][5]; - eq[28][i] = IsEqual(); - eq[28][i].in[0] <== in[i]; - eq[28][i].in[1] <== 102; - and[24][i] = AND(); - and[24][i].a <== states[i][4]; - and[24][i].b <== eq[28][i].out; - states[i+1][6] <== and[24][i].out; - state_changed[i].in[5] <== states[i+1][6]; - eq[29][i] = IsEqual(); - eq[29][i].in[0] <== in[i]; - eq[29][i].in[1] <== 45; - and[25][i] = AND(); - and[25][i].a <== states[i][1]; - and[25][i].b <== eq[29][i].out; - lt[18][i] = LessThan(8); - lt[18][i].in[0] <== 47; - lt[18][i].in[1] <== in[i]; - lt[19][i] = LessThan(8); - lt[19][i].in[0] <== in[i]; - lt[19][i].in[1] <== 58; - and[26][i] = AND(); - and[26][i].a <== lt[18][i].out; - and[26][i].b <== lt[19][i].out; - lt[20][i] = LessThan(8); - lt[20][i].in[0] <== 64; - lt[20][i].in[1] <== in[i]; - lt[21][i] = LessThan(8); - lt[21][i].in[0] <== in[i]; - lt[21][i].in[1] <== 91; - and[27][i] = AND(); - and[27][i].a <== lt[20][i].out; - and[27][i].b <== lt[21][i].out; - lt[22][i] = LessThan(8); - lt[22][i].in[0] <== 96; - lt[22][i].in[1] <== in[i]; - lt[23][i] = LessThan(8); - lt[23][i].in[0] <== in[i]; - lt[23][i].in[1] <== 123; - and[28][i] = AND(); - and[28][i].a <== lt[22][i].out; - and[28][i].b <== lt[23][i].out; - eq[30][i] = IsEqual(); - eq[30][i].in[0] <== in[i]; - eq[30][i].in[1] <== 45; - eq[31][i] = IsEqual(); - eq[31][i].in[0] <== in[i]; - eq[31][i].in[1] <== 46; - eq[32][i] = IsEqual(); - eq[32][i].in[0] <== in[i]; - eq[32][i].in[1] <== 95; - and[29][i] = AND(); - and[29][i].a <== states[i][5]; - multi_or[12][i] = MultiOR(6); - multi_or[12][i].in[0] <== and[26][i].out; - multi_or[12][i].in[1] <== and[27][i].out; - multi_or[12][i].in[2] <== and[28][i].out; - multi_or[12][i].in[3] <== eq[30][i].out; - multi_or[12][i].in[4] <== eq[31][i].out; - multi_or[12][i].in[5] <== eq[32][i].out; - and[29][i].b <== multi_or[12][i].out; + and[23][i].a <== states[i][4]; + and[23][i].b <== eq[23][i].out; + states[i+1][7] <== and[23][i].out; + state_changed[i].in[6] <== states[i+1][7]; lt[24][i] = LessThan(8); lt[24][i].in[0] <== 47; lt[24][i].in[1] <== in[i]; lt[25][i] = LessThan(8); lt[25][i].in[0] <== in[i]; lt[25][i].in[1] <== 58; - and[30][i] = AND(); - and[30][i].a <== lt[24][i].out; - and[30][i].b <== lt[25][i].out; + and[24][i] = AND(); + and[24][i].a <== lt[24][i].out; + and[24][i].b <== lt[25][i].out; lt[26][i] = LessThan(8); lt[26][i].in[0] <== 64; lt[26][i].in[1] <== in[i]; lt[27][i] = LessThan(8); lt[27][i].in[0] <== in[i]; lt[27][i].in[1] <== 91; - and[31][i] = AND(); - and[31][i].a <== lt[26][i].out; - and[31][i].b <== lt[27][i].out; + and[25][i] = AND(); + and[25][i].a <== lt[26][i].out; + and[25][i].b <== lt[27][i].out; lt[28][i] = LessThan(8); lt[28][i].in[0] <== 96; lt[28][i].in[1] <== in[i]; lt[29][i] = LessThan(8); lt[29][i].in[0] <== in[i]; lt[29][i].in[1] <== 123; - and[32][i] = AND(); - and[32][i].a <== lt[28][i].out; - and[32][i].b <== lt[29][i].out; - eq[33][i] = IsEqual(); - eq[33][i].in[0] <== in[i]; - eq[33][i].in[1] <== 45; - eq[34][i] = IsEqual(); - eq[34][i].in[0] <== in[i]; - eq[34][i].in[1] <== 46; - eq[35][i] = IsEqual(); - eq[35][i].in[0] <== in[i]; - eq[35][i].in[1] <== 95; - and[33][i] = AND(); - and[33][i].a <== states[i][7]; - multi_or[13][i] = MultiOR(6); - multi_or[13][i].in[0] <== and[30][i].out; - multi_or[13][i].in[1] <== and[31][i].out; - multi_or[13][i].in[2] <== and[32][i].out; - multi_or[13][i].in[3] <== eq[33][i].out; - multi_or[13][i].in[4] <== eq[34][i].out; - multi_or[13][i].in[5] <== eq[35][i].out; - and[33][i].b <== multi_or[13][i].out; - eq[36][i] = IsEqual(); - eq[36][i].in[0] <== in[i]; - eq[36][i].in[1] <== 45; - and[34][i] = AND(); - and[34][i].a <== states[i][13]; - and[34][i].b <== eq[36][i].out; - multi_or[14][i] = MultiOR(4); - multi_or[14][i].in[0] <== and[25][i].out; - multi_or[14][i].in[1] <== and[29][i].out; - multi_or[14][i].in[2] <== and[33][i].out; - multi_or[14][i].in[3] <== and[34][i].out; - states[i+1][7] <== multi_or[14][i].out; - state_changed[i].in[6] <== states[i+1][7]; - eq[37][i] = IsEqual(); - eq[37][i].in[0] <== in[i]; - eq[37][i].in[1] <== 114; - and[35][i] = AND(); - and[35][i].a <== states[i][6]; - and[35][i].b <== eq[37][i].out; - states[i+1][8] <== and[35][i].out; - state_changed[i].in[7] <== states[i+1][8]; - eq[38][i] = IsEqual(); - eq[38][i].in[0] <== in[i]; - eq[38][i].in[1] <== 64; - and[36][i] = AND(); - and[36][i].a <== states[i][7]; - and[36][i].b <== eq[38][i].out; - states[i+1][9] <== and[36][i].out; - state_changed[i].in[8] <== states[i+1][9]; - eq[39][i] = IsEqual(); - eq[39][i].in[0] <== in[i]; - eq[39][i].in[1] <== 111; - and[37][i] = AND(); - and[37][i].a <== states[i][8]; - and[37][i].b <== eq[39][i].out; - states[i+1][10] <== and[37][i].out; - state_changed[i].in[9] <== states[i+1][10]; - eq[40][i] = IsEqual(); - eq[40][i].in[0] <== in[i]; - eq[40][i].in[1] <== 109; - and[38][i] = AND(); - and[38][i].a <== states[i][10]; - and[38][i].b <== eq[40][i].out; - states[i+1][11] <== and[38][i].out; - state_changed[i].in[10] <== states[i+1][11]; - eq[41][i] = IsEqual(); - eq[41][i].in[0] <== in[i]; - eq[41][i].in[1] <== 64; - and[39][i] = AND(); - and[39][i].a <== states[i][1]; - and[39][i].b <== eq[41][i].out; - states[i+1][12] <== and[39][i].out; - state_changed[i].in[11] <== states[i+1][12]; - eq[42][i] = IsEqual(); - eq[42][i].in[0] <== in[i]; - eq[42][i].in[1] <== 58; - and[40][i] = AND(); - and[40][i].a <== states[i][11]; - and[40][i].b <== eq[42][i].out; - states[i+1][13] <== and[40][i].out; - state_changed[i].in[12] <== states[i+1][13]; + and[26][i] = AND(); + and[26][i].a <== lt[28][i].out; + and[26][i].b <== lt[29][i].out; + eq[24][i] = IsEqual(); + eq[24][i].in[0] <== in[i]; + eq[24][i].in[1] <== 45; + eq[25][i] = IsEqual(); + eq[25][i].in[0] <== in[i]; + eq[25][i].in[1] <== 46; + eq[26][i] = IsEqual(); + eq[26][i].in[0] <== in[i]; + eq[26][i].in[1] <== 95; + and[27][i] = AND(); + and[27][i].a <== states[i][6]; + multi_or[9][i] = MultiOR(6); + multi_or[9][i].in[0] <== and[24][i].out; + multi_or[9][i].in[1] <== and[25][i].out; + multi_or[9][i].in[2] <== and[26][i].out; + multi_or[9][i].in[3] <== eq[24][i].out; + multi_or[9][i].in[4] <== eq[25][i].out; + multi_or[9][i].in[5] <== eq[26][i].out; + and[27][i].b <== multi_or[9][i].out; lt[30][i] = LessThan(8); lt[30][i].in[0] <== 47; lt[30][i].in[1] <== in[i]; lt[31][i] = LessThan(8); lt[31][i].in[0] <== in[i]; lt[31][i].in[1] <== 58; - and[41][i] = AND(); - and[41][i].a <== lt[30][i].out; - and[41][i].b <== lt[31][i].out; + and[28][i] = AND(); + and[28][i].a <== lt[30][i].out; + and[28][i].b <== lt[31][i].out; lt[32][i] = LessThan(8); lt[32][i].in[0] <== 64; lt[32][i].in[1] <== in[i]; lt[33][i] = LessThan(8); lt[33][i].in[0] <== in[i]; lt[33][i].in[1] <== 91; - and[42][i] = AND(); - and[42][i].a <== lt[32][i].out; - and[42][i].b <== lt[33][i].out; + and[29][i] = AND(); + and[29][i].a <== lt[32][i].out; + and[29][i].b <== lt[33][i].out; lt[34][i] = LessThan(8); lt[34][i].in[0] <== 96; lt[34][i].in[1] <== in[i]; lt[35][i] = LessThan(8); lt[35][i].in[0] <== in[i]; lt[35][i].in[1] <== 123; - and[43][i] = AND(); - and[43][i].a <== lt[34][i].out; - and[43][i].b <== lt[35][i].out; - eq[43][i] = IsEqual(); - eq[43][i].in[0] <== in[i]; - eq[43][i].in[1] <== 45; - eq[44][i] = IsEqual(); - eq[44][i].in[0] <== in[i]; - eq[44][i].in[1] <== 46; - eq[45][i] = IsEqual(); - eq[45][i].in[0] <== in[i]; - eq[45][i].in[1] <== 95; - and[44][i] = AND(); - and[44][i].a <== states[i][9]; - multi_or[15][i] = MultiOR(6); - multi_or[15][i].in[0] <== and[41][i].out; - multi_or[15][i].in[1] <== and[42][i].out; - multi_or[15][i].in[2] <== and[43][i].out; - multi_or[15][i].in[3] <== eq[43][i].out; - multi_or[15][i].in[4] <== eq[44][i].out; - multi_or[15][i].in[5] <== eq[45][i].out; - and[44][i].b <== multi_or[15][i].out; - eq[46][i] = IsEqual(); - eq[46][i].in[0] <== in[i]; - eq[46][i].in[1] <== 45; - and[45][i] = AND(); - and[45][i].a <== states[i][12]; - and[45][i].b <== eq[46][i].out; - lt[36][i] = LessThan(8); - lt[36][i].in[0] <== 47; - lt[36][i].in[1] <== in[i]; - lt[37][i] = LessThan(8); - lt[37][i].in[0] <== in[i]; - lt[37][i].in[1] <== 58; - and[46][i] = AND(); - and[46][i].a <== lt[36][i].out; - and[46][i].b <== lt[37][i].out; - lt[38][i] = LessThan(8); - lt[38][i].in[0] <== 64; - lt[38][i].in[1] <== in[i]; - lt[39][i] = LessThan(8); - lt[39][i].in[0] <== in[i]; - lt[39][i].in[1] <== 91; - and[47][i] = AND(); - and[47][i].a <== lt[38][i].out; - and[47][i].b <== lt[39][i].out; - lt[40][i] = LessThan(8); - lt[40][i].in[0] <== 96; - lt[40][i].in[1] <== in[i]; - lt[41][i] = LessThan(8); - lt[41][i].in[0] <== in[i]; - lt[41][i].in[1] <== 123; - and[48][i] = AND(); - and[48][i].a <== lt[40][i].out; - and[48][i].b <== lt[41][i].out; - eq[47][i] = IsEqual(); - eq[47][i].in[0] <== in[i]; - eq[47][i].in[1] <== 45; - eq[48][i] = IsEqual(); - eq[48][i].in[0] <== in[i]; - eq[48][i].in[1] <== 46; - eq[49][i] = IsEqual(); - eq[49][i].in[0] <== in[i]; - eq[49][i].in[1] <== 95; - and[49][i] = AND(); - and[49][i].a <== states[i][14]; - multi_or[16][i] = MultiOR(6); - multi_or[16][i].in[0] <== and[46][i].out; - multi_or[16][i].in[1] <== and[47][i].out; - multi_or[16][i].in[2] <== and[48][i].out; - multi_or[16][i].in[3] <== eq[47][i].out; - multi_or[16][i].in[4] <== eq[48][i].out; - multi_or[16][i].in[5] <== eq[49][i].out; - and[49][i].b <== multi_or[16][i].out; - eq[50][i] = IsEqual(); - eq[50][i].in[0] <== in[i]; - eq[50][i].in[1] <== 45; - and[50][i] = AND(); - and[50][i].a <== states[i][15]; - and[50][i].b <== eq[50][i].out; - multi_or[17][i] = MultiOR(4); - multi_or[17][i].in[0] <== and[44][i].out; - multi_or[17][i].in[1] <== and[45][i].out; - multi_or[17][i].in[2] <== and[49][i].out; - multi_or[17][i].in[3] <== and[50][i].out; - states[i+1][14] <== multi_or[17][i].out; + and[30][i] = AND(); + and[30][i].a <== lt[34][i].out; + and[30][i].b <== lt[35][i].out; + eq[27][i] = IsEqual(); + eq[27][i].in[0] <== in[i]; + eq[27][i].in[1] <== 45; + eq[28][i] = IsEqual(); + eq[28][i].in[0] <== in[i]; + eq[28][i].in[1] <== 46; + eq[29][i] = IsEqual(); + eq[29][i].in[0] <== in[i]; + eq[29][i].in[1] <== 95; + and[31][i] = AND(); + and[31][i].a <== states[i][8]; + multi_or[10][i] = MultiOR(6); + multi_or[10][i].in[0] <== and[28][i].out; + multi_or[10][i].in[1] <== and[29][i].out; + multi_or[10][i].in[2] <== and[30][i].out; + multi_or[10][i].in[3] <== eq[27][i].out; + multi_or[10][i].in[4] <== eq[28][i].out; + multi_or[10][i].in[5] <== eq[29][i].out; + and[31][i].b <== multi_or[10][i].out; + multi_or[11][i] = MultiOR(2); + multi_or[11][i].in[0] <== and[27][i].out; + multi_or[11][i].in[1] <== and[31][i].out; + states[i+1][8] <== multi_or[11][i].out; + state_changed[i].in[7] <== states[i+1][8]; + eq[30][i] = IsEqual(); + eq[30][i].in[0] <== in[i]; + eq[30][i].in[1] <== 114; + and[32][i] = AND(); + and[32][i].a <== states[i][7]; + and[32][i].b <== eq[30][i].out; + states[i+1][9] <== and[32][i].out; + state_changed[i].in[8] <== states[i+1][9]; + eq[31][i] = IsEqual(); + eq[31][i].in[0] <== in[i]; + eq[31][i].in[1] <== 111; + and[33][i] = AND(); + and[33][i].a <== states[i][9]; + and[33][i].b <== eq[31][i].out; + states[i+1][10] <== and[33][i].out; + state_changed[i].in[9] <== states[i+1][10]; + eq[32][i] = IsEqual(); + eq[32][i].in[0] <== in[i]; + eq[32][i].in[1] <== 109; + and[34][i] = AND(); + and[34][i].a <== states[i][10]; + and[34][i].b <== eq[32][i].out; + states[i+1][11] <== and[34][i].out; + state_changed[i].in[10] <== states[i+1][11]; + eq[33][i] = IsEqual(); + eq[33][i].in[0] <== in[i]; + eq[33][i].in[1] <== 13; + and[35][i] = AND(); + and[35][i].a <== states[i][8]; + and[35][i].b <== eq[33][i].out; + eq[34][i] = IsEqual(); + eq[34][i].in[0] <== in[i]; + eq[34][i].in[1] <== 13; + and[36][i] = AND(); + and[36][i].a <== states[i][13]; + and[36][i].b <== eq[34][i].out; + multi_or[12][i] = MultiOR(2); + multi_or[12][i].in[0] <== and[35][i].out; + multi_or[12][i].in[1] <== and[36][i].out; + states[i+1][12] <== multi_or[12][i].out; + state_changed[i].in[11] <== states[i+1][12]; + eq[35][i] = IsEqual(); + eq[35][i].in[0] <== in[i]; + eq[35][i].in[1] <== 62; + and[37][i] = AND(); + and[37][i].a <== states[i][8]; + and[37][i].b <== eq[35][i].out; + states[i+1][13] <== and[37][i].out; + state_changed[i].in[12] <== states[i+1][13]; + eq[36][i] = IsEqual(); + eq[36][i].in[0] <== in[i]; + eq[36][i].in[1] <== 58; + and[38][i] = AND(); + and[38][i].a <== states[i][11]; + and[38][i].b <== eq[36][i].out; + states[i+1][14] <== and[38][i].out; state_changed[i].in[13] <== states[i+1][14]; - lt[42][i] = LessThan(8); - lt[42][i].in[0] <== 47; - lt[42][i].in[1] <== in[i]; - lt[43][i] = LessThan(8); - lt[43][i].in[0] <== in[i]; - lt[43][i].in[1] <== 58; - and[51][i] = AND(); - and[51][i].a <== lt[42][i].out; - and[51][i].b <== lt[43][i].out; - lt[44][i] = LessThan(8); - lt[44][i].in[0] <== 64; - lt[44][i].in[1] <== in[i]; - lt[45][i] = LessThan(8); - lt[45][i].in[0] <== in[i]; - lt[45][i].in[1] <== 91; - and[52][i] = AND(); - and[52][i].a <== lt[44][i].out; - and[52][i].b <== lt[45][i].out; - lt[46][i] = LessThan(8); - lt[46][i].in[0] <== 96; - lt[46][i].in[1] <== in[i]; - lt[47][i] = LessThan(8); - lt[47][i].in[0] <== in[i]; - lt[47][i].in[1] <== 123; - and[53][i] = AND(); - and[53][i].a <== lt[46][i].out; - and[53][i].b <== lt[47][i].out; - eq[51][i] = IsEqual(); - eq[51][i].in[0] <== in[i]; - eq[51][i].in[1] <== 46; - eq[52][i] = IsEqual(); - eq[52][i].in[0] <== in[i]; - eq[52][i].in[1] <== 95; - and[54][i] = AND(); - and[54][i].a <== states[i][12]; - multi_or[18][i] = MultiOR(5); - multi_or[18][i].in[0] <== and[51][i].out; - multi_or[18][i].in[1] <== and[52][i].out; - multi_or[18][i].in[2] <== and[53][i].out; - multi_or[18][i].in[3] <== eq[51][i].out; - multi_or[18][i].in[4] <== eq[52][i].out; - and[54][i].b <== multi_or[18][i].out; - lt[48][i] = LessThan(8); - lt[48][i].in[0] <== 47; - lt[48][i].in[1] <== in[i]; - lt[49][i] = LessThan(8); - lt[49][i].in[0] <== in[i]; - lt[49][i].in[1] <== 58; - and[55][i] = AND(); - and[55][i].a <== lt[48][i].out; - and[55][i].b <== lt[49][i].out; - lt[50][i] = LessThan(8); - lt[50][i].in[0] <== 64; - lt[50][i].in[1] <== in[i]; - lt[51][i] = LessThan(8); - lt[51][i].in[0] <== in[i]; - lt[51][i].in[1] <== 91; - and[56][i] = AND(); - and[56][i].a <== lt[50][i].out; - and[56][i].b <== lt[51][i].out; - lt[52][i] = LessThan(8); - lt[52][i].in[0] <== 96; - lt[52][i].in[1] <== in[i]; - lt[53][i] = LessThan(8); - lt[53][i].in[0] <== in[i]; - lt[53][i].in[1] <== 123; - and[57][i] = AND(); - and[57][i].a <== lt[52][i].out; - and[57][i].b <== lt[53][i].out; - eq[53][i] = IsEqual(); - eq[53][i].in[0] <== in[i]; - eq[53][i].in[1] <== 46; - eq[54][i] = IsEqual(); - eq[54][i].in[0] <== in[i]; - eq[54][i].in[1] <== 95; - and[58][i] = AND(); - and[58][i].a <== states[i][15]; - multi_or[19][i] = MultiOR(5); - multi_or[19][i].in[0] <== and[55][i].out; - multi_or[19][i].in[1] <== and[56][i].out; - multi_or[19][i].in[2] <== and[57][i].out; - multi_or[19][i].in[3] <== eq[53][i].out; - multi_or[19][i].in[4] <== eq[54][i].out; - and[58][i].b <== multi_or[19][i].out; - multi_or[20][i] = MultiOR(2); - multi_or[20][i].in[0] <== and[54][i].out; - multi_or[20][i].in[1] <== and[58][i].out; - states[i+1][15] <== multi_or[20][i].out; + eq[37][i] = IsEqual(); + eq[37][i].in[0] <== in[i]; + eq[37][i].in[1] <== 10; + and[39][i] = AND(); + and[39][i].a <== states[i][12]; + and[39][i].b <== eq[37][i].out; + states[i+1][15] <== and[39][i].out; state_changed[i].in[14] <== states[i+1][15]; - eq[55][i] = IsEqual(); - eq[55][i].in[0] <== in[i]; - eq[55][i].in[1] <== 13; - and[59][i] = AND(); - and[59][i].a <== states[i][14]; - and[59][i].b <== eq[55][i].out; - eq[56][i] = IsEqual(); - eq[56][i].in[0] <== in[i]; - eq[56][i].in[1] <== 13; - and[60][i] = AND(); - and[60][i].a <== states[i][15]; - and[60][i].b <== eq[56][i].out; - eq[57][i] = IsEqual(); - eq[57][i].in[0] <== in[i]; - eq[57][i].in[1] <== 13; - and[61][i] = AND(); - and[61][i].a <== states[i][17]; - and[61][i].b <== eq[57][i].out; - multi_or[21][i] = MultiOR(3); - multi_or[21][i].in[0] <== and[59][i].out; - multi_or[21][i].in[1] <== and[60][i].out; - multi_or[21][i].in[2] <== and[61][i].out; - states[i+1][16] <== multi_or[21][i].out; - state_changed[i].in[15] <== states[i+1][16]; - eq[58][i] = IsEqual(); - eq[58][i].in[0] <== in[i]; - eq[58][i].in[1] <== 62; - and[62][i] = AND(); - and[62][i].a <== states[i][14]; - and[62][i].b <== eq[58][i].out; - eq[59][i] = IsEqual(); - eq[59][i].in[0] <== in[i]; - eq[59][i].in[1] <== 62; - and[63][i] = AND(); - and[63][i].a <== states[i][15]; - and[63][i].b <== eq[59][i].out; - multi_or[22][i] = MultiOR(2); - multi_or[22][i].in[0] <== and[62][i].out; - multi_or[22][i].in[1] <== and[63][i].out; - states[i+1][17] <== multi_or[22][i].out; - state_changed[i].in[16] <== states[i+1][17]; - eq[60][i] = IsEqual(); - eq[60][i].in[0] <== in[i]; - eq[60][i].in[1] <== 10; - and[64][i] = AND(); - and[64][i].a <== states[i][16]; - and[64][i].b <== eq[60][i].out; - states[i+1][18] <== and[64][i].out; - state_changed[i].in[17] <== states[i+1][18]; states[i+1][0] <== 1 - state_changed[i].out; } component final_state_result = MultiOR(num_bytes+1); for (var i = 0; i <= num_bytes; i++) { - final_state_result.in[i] <== states[i][18]; + final_state_result.in[i] <== states[i][15]; } out <== final_state_result.out; signal is_consecutive[msg_bytes+1][2]; is_consecutive[msg_bytes][1] <== 1; for (var i = 0; i < msg_bytes; i++) { - is_consecutive[msg_bytes-1-i][0] <== states[num_bytes-i][18] * (1 - is_consecutive[msg_bytes-i][1]) + is_consecutive[msg_bytes-i][1]; + is_consecutive[msg_bytes-1-i][0] <== states[num_bytes-i][15] * (1 - is_consecutive[msg_bytes-i][1]) + is_consecutive[msg_bytes-i][1]; is_consecutive[msg_bytes-1-i][1] <== state_changed[msg_bytes-i].out * is_consecutive[msg_bytes-1-i][0]; } - signal is_substr0[msg_bytes][15]; + signal is_substr0[msg_bytes][7]; signal is_reveal0[msg_bytes]; signal output reveal0[msg_bytes]; for (var i = 0; i < msg_bytes; i++) { is_substr0[i][0] <== 0; - is_substr0[i][1] <== is_substr0[i][0] + states[i+1][9] * states[i+2][14]; - is_substr0[i][2] <== is_substr0[i][1] + states[i+1][1] * states[i+2][1]; - is_substr0[i][3] <== is_substr0[i][2] + states[i+1][14] * states[i+2][14]; - is_substr0[i][4] <== is_substr0[i][3] + states[i+1][1] * states[i+2][12]; - is_substr0[i][5] <== is_substr0[i][4] + states[i+1][12] * states[i+2][15]; - is_substr0[i][6] <== is_substr0[i][5] + states[i+1][12] * states[i+2][14]; - is_substr0[i][7] <== is_substr0[i][6] + states[i+1][15] * states[i+2][14]; - is_substr0[i][8] <== is_substr0[i][7] + states[i+1][13] * states[i+2][1]; - is_substr0[i][9] <== is_substr0[i][8] + states[i+1][7] * states[i+2][9]; - is_substr0[i][10] <== is_substr0[i][9] + states[i+1][15] * states[i+2][15]; - is_substr0[i][11] <== is_substr0[i][10] + states[i+1][5] * states[i+2][7]; - is_substr0[i][12] <== is_substr0[i][11] + states[i+1][7] * states[i+2][7]; - is_substr0[i][13] <== is_substr0[i][12] + states[i+1][13] * states[i+2][7]; - is_substr0[i][14] <== is_substr0[i][13] + states[i+1][1] * states[i+2][7]; - is_reveal0[i] <== is_substr0[i][14] * is_consecutive[i][1]; + is_substr0[i][1] <== is_substr0[i][0] + states[i+1][8] * states[i+2][8]; + is_substr0[i][2] <== is_substr0[i][1] + states[i+1][14] * states[i+2][1]; + is_substr0[i][3] <== is_substr0[i][2] + states[i+1][1] * states[i+2][6]; + is_substr0[i][4] <== is_substr0[i][3] + states[i+1][5] * states[i+2][1]; + is_substr0[i][5] <== is_substr0[i][4] + states[i+1][1] * states[i+2][1]; + is_substr0[i][6] <== is_substr0[i][5] + states[i+1][6] * states[i+2][8]; + is_reveal0[i] <== is_substr0[i][6] * is_consecutive[i][1]; reveal0[i] <== in[i+1] * is_reveal0[i]; } } \ No newline at end of file diff --git a/packages/circom/circuits/common/timestamp_regex.circom b/packages/circom/circuits/common/timestamp_regex.circom index 4c95295..f5a6dbd 100644 --- a/packages/circom/circuits/common/timestamp_regex.circom +++ b/packages/circom/circuits/common/timestamp_regex.circom @@ -13,10 +13,10 @@ template TimestampRegex(msg_bytes) { in[i+1] <== msg[i]; } - component eq[147][num_bytes]; - component lt[18][num_bytes]; - component and[39][num_bytes]; - component multi_or[9][num_bytes]; + component eq[49][num_bytes]; + component lt[12][num_bytes]; + component and[36][num_bytes]; + component multi_or[6][num_bytes]; signal states[num_bytes+1][25]; component state_changed[num_bytes]; @@ -27,6 +27,18 @@ template TimestampRegex(msg_bytes) { for (var i = 0; i < num_bytes; i++) { state_changed[i] = MultiOR(24); + lt[0][i] = LessThan(8); + lt[0][i].in[0] <== 96; + lt[0][i].in[1] <== in[i]; + lt[1][i] = LessThan(8); + lt[1][i].in[0] <== in[i]; + lt[1][i].in[1] <== 123; + and[0][i] = AND(); + and[0][i].a <== lt[0][i].out; + and[0][i].b <== lt[1][i].out; + and[1][i] = AND(); + and[1][i].a <== states[i][1]; + and[1][i].b <== and[0][i].out; eq[0][i] = IsEqual(); eq[0][i].in[0] <== in[i]; eq[0][i].in[1] <== 97; @@ -102,8 +114,8 @@ template TimestampRegex(msg_bytes) { eq[24][i] = IsEqual(); eq[24][i].in[0] <== in[i]; eq[24][i].in[1] <== 122; - and[0][i] = AND(); - and[0][i].a <== states[i][13]; + and[2][i] = AND(); + and[2][i].a <== states[i][6]; multi_or[0][i] = MultiOR(25); multi_or[0][i].in[0] <== eq[0][i].out; multi_or[0][i].in[1] <== eq[1][i].out; @@ -130,726 +142,286 @@ template TimestampRegex(msg_bytes) { multi_or[0][i].in[22] <== eq[22][i].out; multi_or[0][i].in[23] <== eq[23][i].out; multi_or[0][i].in[24] <== eq[24][i].out; - and[0][i].b <== multi_or[0][i].out; - lt[0][i] = LessThan(8); - lt[0][i].in[0] <== 96; - lt[0][i].in[1] <== in[i]; - lt[1][i] = LessThan(8); - lt[1][i].in[0] <== in[i]; - lt[1][i].in[1] <== 123; - and[1][i] = AND(); - and[1][i].a <== lt[0][i].out; - and[1][i].b <== lt[1][i].out; - and[2][i] = AND(); - and[2][i].a <== states[i][23]; - and[2][i].b <== and[1][i].out; - multi_or[1][i] = MultiOR(2); - multi_or[1][i].in[0] <== and[0][i].out; - multi_or[1][i].in[1] <== and[2][i].out; - states[i+1][1] <== multi_or[1][i].out; - state_changed[i].in[0] <== states[i+1][1]; - eq[25][i] = IsEqual(); - eq[25][i].in[0] <== in[i]; - eq[25][i].in[1] <== 61; - and[3][i] = AND(); - and[3][i].a <== states[i][1]; - and[3][i].b <== eq[25][i].out; - states[i+1][2] <== and[3][i].out; - state_changed[i].in[1] <== states[i+1][2]; + and[2][i].b <== multi_or[0][i].out; lt[2][i] = LessThan(8); - lt[2][i].in[0] <== 47; + lt[2][i].in[0] <== 96; lt[2][i].in[1] <== in[i]; lt[3][i] = LessThan(8); lt[3][i].in[0] <== in[i]; - lt[3][i].in[1] <== 58; + lt[3][i].in[1] <== 123; + and[3][i] = AND(); + and[3][i].a <== lt[2][i].out; + and[3][i].b <== lt[3][i].out; and[4][i] = AND(); - and[4][i].a <== lt[2][i].out; - and[4][i].b <== lt[3][i].out; + and[4][i].a <== states[i][8]; + and[4][i].b <== and[3][i].out; lt[4][i] = LessThan(8); - lt[4][i].in[0] <== 64; + lt[4][i].in[0] <== 96; lt[4][i].in[1] <== in[i]; lt[5][i] = LessThan(8); lt[5][i].in[0] <== in[i]; - lt[5][i].in[1] <== 127; + lt[5][i].in[1] <== 123; and[5][i] = AND(); and[5][i].a <== lt[4][i].out; and[5][i].b <== lt[5][i].out; + and[6][i] = AND(); + and[6][i].a <== states[i][24]; + and[6][i].b <== and[5][i].out; + multi_or[1][i] = MultiOR(4); + multi_or[1][i].in[0] <== and[1][i].out; + multi_or[1][i].in[1] <== and[2][i].out; + multi_or[1][i].in[2] <== and[4][i].out; + multi_or[1][i].in[3] <== and[6][i].out; + states[i+1][1] <== multi_or[1][i].out; + state_changed[i].in[0] <== states[i+1][1]; + eq[25][i] = IsEqual(); + eq[25][i].in[0] <== in[i]; + eq[25][i].in[1] <== 61; + and[7][i] = AND(); + and[7][i].a <== states[i][1]; + and[7][i].b <== eq[25][i].out; + states[i+1][2] <== and[7][i].out; + state_changed[i].in[1] <== states[i+1][2]; eq[26][i] = IsEqual(); eq[26][i].in[0] <== in[i]; - eq[26][i].in[1] <== 9; + eq[26][i].in[1] <== 100; + and[8][i] = AND(); + and[8][i].a <== states[i][0]; + and[8][i].b <== eq[26][i].out; + states[i+1][3] <== and[8][i].out; + state_changed[i].in[2] <== states[i+1][3]; eq[27][i] = IsEqual(); eq[27][i].in[0] <== in[i]; - eq[27][i].in[1] <== 10; + eq[27][i].in[1] <== 59; + and[9][i] = AND(); + and[9][i].a <== states[i][2]; + and[9][i].b <== 1 - eq[27][i].out; + lt[6][i] = LessThan(8); + lt[6][i].in[0] <== 47; + lt[6][i].in[1] <== in[i]; + lt[7][i] = LessThan(8); + lt[7][i].in[0] <== in[i]; + lt[7][i].in[1] <== 58; + and[10][i] = AND(); + and[10][i].a <== lt[6][i].out; + and[10][i].b <== lt[7][i].out; eq[28][i] = IsEqual(); eq[28][i].in[0] <== in[i]; - eq[28][i].in[1] <== 13; + eq[28][i].in[1] <== 59; + and[11][i] = AND(); + and[11][i].a <== states[i][10]; + multi_or[2][i] = MultiOR(2); + multi_or[2][i].in[0] <== and[10][i].out; + multi_or[2][i].in[1] <== eq[28][i].out; + and[11][i].b <== 1 - multi_or[2][i].out; + multi_or[3][i] = MultiOR(2); + multi_or[3][i].in[0] <== and[9][i].out; + multi_or[3][i].in[1] <== and[11][i].out; + states[i+1][4] <== multi_or[3][i].out; + state_changed[i].in[3] <== states[i+1][4]; eq[29][i] = IsEqual(); eq[29][i].in[0] <== in[i]; - eq[29][i].in[1] <== 32; + eq[29][i].in[1] <== 59; + and[12][i] = AND(); + and[12][i].a <== states[i][4]; + and[12][i].b <== eq[29][i].out; eq[30][i] = IsEqual(); eq[30][i].in[0] <== in[i]; - eq[30][i].in[1] <== 33; + eq[30][i].in[1] <== 59; + and[13][i] = AND(); + and[13][i].a <== states[i][5]; + and[13][i].b <== eq[30][i].out; + multi_or[4][i] = MultiOR(2); + multi_or[4][i].in[0] <== and[12][i].out; + multi_or[4][i].in[1] <== and[13][i].out; + states[i+1][5] <== multi_or[4][i].out; + state_changed[i].in[4] <== states[i+1][5]; eq[31][i] = IsEqual(); eq[31][i].in[0] <== in[i]; - eq[31][i].in[1] <== 34; + eq[31][i].in[1] <== 32; + and[14][i] = AND(); + and[14][i].a <== states[i][5]; + and[14][i].b <== eq[31][i].out; + states[i+1][6] <== and[14][i].out; + state_changed[i].in[5] <== states[i+1][6]; eq[32][i] = IsEqual(); eq[32][i].in[0] <== in[i]; - eq[32][i].in[1] <== 35; + eq[32][i].in[1] <== 107; + and[15][i] = AND(); + and[15][i].a <== states[i][3]; + and[15][i].b <== eq[32][i].out; + states[i+1][7] <== and[15][i].out; + state_changed[i].in[6] <== states[i+1][7]; eq[33][i] = IsEqual(); eq[33][i].in[0] <== in[i]; - eq[33][i].in[1] <== 36; + eq[33][i].in[1] <== 116; + and[16][i] = AND(); + and[16][i].a <== states[i][6]; + and[16][i].b <== eq[33][i].out; + states[i+1][8] <== and[16][i].out; + state_changed[i].in[7] <== states[i+1][8]; eq[34][i] = IsEqual(); eq[34][i].in[0] <== in[i]; - eq[34][i].in[1] <== 37; + eq[34][i].in[1] <== 105; + and[17][i] = AND(); + and[17][i].a <== states[i][7]; + and[17][i].b <== eq[34][i].out; + states[i+1][9] <== and[17][i].out; + state_changed[i].in[8] <== states[i+1][9]; eq[35][i] = IsEqual(); eq[35][i].in[0] <== in[i]; - eq[35][i].in[1] <== 38; + eq[35][i].in[1] <== 61; + and[18][i] = AND(); + and[18][i].a <== states[i][8]; + and[18][i].b <== eq[35][i].out; + states[i+1][10] <== and[18][i].out; + state_changed[i].in[9] <== states[i+1][10]; eq[36][i] = IsEqual(); eq[36][i].in[0] <== in[i]; - eq[36][i].in[1] <== 39; - eq[37][i] = IsEqual(); - eq[37][i].in[0] <== in[i]; - eq[37][i].in[1] <== 40; - eq[38][i] = IsEqual(); - eq[38][i].in[0] <== in[i]; - eq[38][i].in[1] <== 41; - eq[39][i] = IsEqual(); - eq[39][i].in[0] <== in[i]; - eq[39][i].in[1] <== 42; - eq[40][i] = IsEqual(); - eq[40][i].in[0] <== in[i]; - eq[40][i].in[1] <== 43; - eq[41][i] = IsEqual(); - eq[41][i].in[0] <== in[i]; - eq[41][i].in[1] <== 44; - eq[42][i] = IsEqual(); - eq[42][i].in[0] <== in[i]; - eq[42][i].in[1] <== 45; - eq[43][i] = IsEqual(); - eq[43][i].in[0] <== in[i]; - eq[43][i].in[1] <== 46; - eq[44][i] = IsEqual(); - eq[44][i].in[0] <== in[i]; - eq[44][i].in[1] <== 47; - eq[45][i] = IsEqual(); - eq[45][i].in[0] <== in[i]; - eq[45][i].in[1] <== 58; - eq[46][i] = IsEqual(); - eq[46][i].in[0] <== in[i]; - eq[46][i].in[1] <== 60; - eq[47][i] = IsEqual(); - eq[47][i].in[0] <== in[i]; - eq[47][i].in[1] <== 61; - eq[48][i] = IsEqual(); - eq[48][i].in[0] <== in[i]; - eq[48][i].in[1] <== 62; - eq[49][i] = IsEqual(); - eq[49][i].in[0] <== in[i]; - eq[49][i].in[1] <== 63; - eq[50][i] = IsEqual(); - eq[50][i].in[0] <== in[i]; - eq[50][i].in[1] <== 64; - and[6][i] = AND(); - and[6][i].a <== states[i][2]; - multi_or[2][i] = MultiOR(27); - multi_or[2][i].in[0] <== and[4][i].out; - multi_or[2][i].in[1] <== and[5][i].out; - multi_or[2][i].in[2] <== eq[26][i].out; - multi_or[2][i].in[3] <== eq[27][i].out; - multi_or[2][i].in[4] <== eq[28][i].out; - multi_or[2][i].in[5] <== eq[29][i].out; - multi_or[2][i].in[6] <== eq[30][i].out; - multi_or[2][i].in[7] <== eq[31][i].out; - multi_or[2][i].in[8] <== eq[32][i].out; - multi_or[2][i].in[9] <== eq[33][i].out; - multi_or[2][i].in[10] <== eq[34][i].out; - multi_or[2][i].in[11] <== eq[35][i].out; - multi_or[2][i].in[12] <== eq[36][i].out; - multi_or[2][i].in[13] <== eq[37][i].out; - multi_or[2][i].in[14] <== eq[38][i].out; - multi_or[2][i].in[15] <== eq[39][i].out; - multi_or[2][i].in[16] <== eq[40][i].out; - multi_or[2][i].in[17] <== eq[41][i].out; - multi_or[2][i].in[18] <== eq[42][i].out; - multi_or[2][i].in[19] <== eq[43][i].out; - multi_or[2][i].in[20] <== eq[44][i].out; - multi_or[2][i].in[21] <== eq[45][i].out; - multi_or[2][i].in[22] <== eq[46][i].out; - multi_or[2][i].in[23] <== eq[47][i].out; - multi_or[2][i].in[24] <== eq[48][i].out; - multi_or[2][i].in[25] <== eq[49][i].out; - multi_or[2][i].in[26] <== eq[50][i].out; - and[6][i].b <== multi_or[2][i].out; - lt[6][i] = LessThan(8); - lt[6][i].in[0] <== 47; - lt[6][i].in[1] <== in[i]; - lt[7][i] = LessThan(8); - lt[7][i].in[0] <== in[i]; - lt[7][i].in[1] <== 58; - and[7][i] = AND(); - and[7][i].a <== lt[6][i].out; - and[7][i].b <== lt[7][i].out; + eq[36][i].in[1] <== 109; + and[19][i] = AND(); + and[19][i].a <== states[i][9]; + and[19][i].b <== eq[36][i].out; + states[i+1][11] <== and[19][i].out; + state_changed[i].in[10] <== states[i+1][11]; lt[8][i] = LessThan(8); - lt[8][i].in[0] <== 64; + lt[8][i].in[0] <== 47; lt[8][i].in[1] <== in[i]; lt[9][i] = LessThan(8); lt[9][i].in[0] <== in[i]; - lt[9][i].in[1] <== 127; - and[8][i] = AND(); - and[8][i].a <== lt[8][i].out; - and[8][i].b <== lt[9][i].out; - eq[51][i] = IsEqual(); - eq[51][i].in[0] <== in[i]; - eq[51][i].in[1] <== 9; - eq[52][i] = IsEqual(); - eq[52][i].in[0] <== in[i]; - eq[52][i].in[1] <== 10; - eq[53][i] = IsEqual(); - eq[53][i].in[0] <== in[i]; - eq[53][i].in[1] <== 13; - eq[54][i] = IsEqual(); - eq[54][i].in[0] <== in[i]; - eq[54][i].in[1] <== 32; - eq[55][i] = IsEqual(); - eq[55][i].in[0] <== in[i]; - eq[55][i].in[1] <== 33; - eq[56][i] = IsEqual(); - eq[56][i].in[0] <== in[i]; - eq[56][i].in[1] <== 34; - eq[57][i] = IsEqual(); - eq[57][i].in[0] <== in[i]; - eq[57][i].in[1] <== 35; - eq[58][i] = IsEqual(); - eq[58][i].in[0] <== in[i]; - eq[58][i].in[1] <== 36; - eq[59][i] = IsEqual(); - eq[59][i].in[0] <== in[i]; - eq[59][i].in[1] <== 37; - eq[60][i] = IsEqual(); - eq[60][i].in[0] <== in[i]; - eq[60][i].in[1] <== 38; - eq[61][i] = IsEqual(); - eq[61][i].in[0] <== in[i]; - eq[61][i].in[1] <== 39; - eq[62][i] = IsEqual(); - eq[62][i].in[0] <== in[i]; - eq[62][i].in[1] <== 40; - eq[63][i] = IsEqual(); - eq[63][i].in[0] <== in[i]; - eq[63][i].in[1] <== 41; - eq[64][i] = IsEqual(); - eq[64][i].in[0] <== in[i]; - eq[64][i].in[1] <== 42; - eq[65][i] = IsEqual(); - eq[65][i].in[0] <== in[i]; - eq[65][i].in[1] <== 43; - eq[66][i] = IsEqual(); - eq[66][i].in[0] <== in[i]; - eq[66][i].in[1] <== 44; - eq[67][i] = IsEqual(); - eq[67][i].in[0] <== in[i]; - eq[67][i].in[1] <== 45; - eq[68][i] = IsEqual(); - eq[68][i].in[0] <== in[i]; - eq[68][i].in[1] <== 46; - eq[69][i] = IsEqual(); - eq[69][i].in[0] <== in[i]; - eq[69][i].in[1] <== 47; - eq[70][i] = IsEqual(); - eq[70][i].in[0] <== in[i]; - eq[70][i].in[1] <== 58; - eq[71][i] = IsEqual(); - eq[71][i].in[0] <== in[i]; - eq[71][i].in[1] <== 60; - eq[72][i] = IsEqual(); - eq[72][i].in[0] <== in[i]; - eq[72][i].in[1] <== 61; - eq[73][i] = IsEqual(); - eq[73][i].in[0] <== in[i]; - eq[73][i].in[1] <== 62; - eq[74][i] = IsEqual(); - eq[74][i].in[0] <== in[i]; - eq[74][i].in[1] <== 63; - eq[75][i] = IsEqual(); - eq[75][i].in[0] <== in[i]; - eq[75][i].in[1] <== 64; - and[9][i] = AND(); - and[9][i].a <== states[i][3]; - multi_or[3][i] = MultiOR(27); - multi_or[3][i].in[0] <== and[7][i].out; - multi_or[3][i].in[1] <== and[8][i].out; - multi_or[3][i].in[2] <== eq[51][i].out; - multi_or[3][i].in[3] <== eq[52][i].out; - multi_or[3][i].in[4] <== eq[53][i].out; - multi_or[3][i].in[5] <== eq[54][i].out; - multi_or[3][i].in[6] <== eq[55][i].out; - multi_or[3][i].in[7] <== eq[56][i].out; - multi_or[3][i].in[8] <== eq[57][i].out; - multi_or[3][i].in[9] <== eq[58][i].out; - multi_or[3][i].in[10] <== eq[59][i].out; - multi_or[3][i].in[11] <== eq[60][i].out; - multi_or[3][i].in[12] <== eq[61][i].out; - multi_or[3][i].in[13] <== eq[62][i].out; - multi_or[3][i].in[14] <== eq[63][i].out; - multi_or[3][i].in[15] <== eq[64][i].out; - multi_or[3][i].in[16] <== eq[65][i].out; - multi_or[3][i].in[17] <== eq[66][i].out; - multi_or[3][i].in[18] <== eq[67][i].out; - multi_or[3][i].in[19] <== eq[68][i].out; - multi_or[3][i].in[20] <== eq[69][i].out; - multi_or[3][i].in[21] <== eq[70][i].out; - multi_or[3][i].in[22] <== eq[71][i].out; - multi_or[3][i].in[23] <== eq[72][i].out; - multi_or[3][i].in[24] <== eq[73][i].out; - multi_or[3][i].in[25] <== eq[74][i].out; - multi_or[3][i].in[26] <== eq[75][i].out; - and[9][i].b <== multi_or[3][i].out; + lt[9][i].in[1] <== 58; + and[20][i] = AND(); + and[20][i].a <== lt[8][i].out; + and[20][i].b <== lt[9][i].out; + and[21][i] = AND(); + and[21][i].a <== states[i][10]; + and[21][i].b <== and[20][i].out; lt[10][i] = LessThan(8); - lt[10][i].in[0] <== 64; + lt[10][i].in[0] <== 47; lt[10][i].in[1] <== in[i]; lt[11][i] = LessThan(8); lt[11][i].in[0] <== in[i]; - lt[11][i].in[1] <== 127; - and[10][i] = AND(); - and[10][i].a <== lt[10][i].out; - and[10][i].b <== lt[11][i].out; - eq[76][i] = IsEqual(); - eq[76][i].in[0] <== in[i]; - eq[76][i].in[1] <== 9; - eq[77][i] = IsEqual(); - eq[77][i].in[0] <== in[i]; - eq[77][i].in[1] <== 10; - eq[78][i] = IsEqual(); - eq[78][i].in[0] <== in[i]; - eq[78][i].in[1] <== 13; - eq[79][i] = IsEqual(); - eq[79][i].in[0] <== in[i]; - eq[79][i].in[1] <== 32; - eq[80][i] = IsEqual(); - eq[80][i].in[0] <== in[i]; - eq[80][i].in[1] <== 33; - eq[81][i] = IsEqual(); - eq[81][i].in[0] <== in[i]; - eq[81][i].in[1] <== 34; - eq[82][i] = IsEqual(); - eq[82][i].in[0] <== in[i]; - eq[82][i].in[1] <== 35; - eq[83][i] = IsEqual(); - eq[83][i].in[0] <== in[i]; - eq[83][i].in[1] <== 36; - eq[84][i] = IsEqual(); - eq[84][i].in[0] <== in[i]; - eq[84][i].in[1] <== 37; - eq[85][i] = IsEqual(); - eq[85][i].in[0] <== in[i]; - eq[85][i].in[1] <== 38; - eq[86][i] = IsEqual(); - eq[86][i].in[0] <== in[i]; - eq[86][i].in[1] <== 39; - eq[87][i] = IsEqual(); - eq[87][i].in[0] <== in[i]; - eq[87][i].in[1] <== 40; - eq[88][i] = IsEqual(); - eq[88][i].in[0] <== in[i]; - eq[88][i].in[1] <== 41; - eq[89][i] = IsEqual(); - eq[89][i].in[0] <== in[i]; - eq[89][i].in[1] <== 42; - eq[90][i] = IsEqual(); - eq[90][i].in[0] <== in[i]; - eq[90][i].in[1] <== 43; - eq[91][i] = IsEqual(); - eq[91][i].in[0] <== in[i]; - eq[91][i].in[1] <== 44; - eq[92][i] = IsEqual(); - eq[92][i].in[0] <== in[i]; - eq[92][i].in[1] <== 45; - eq[93][i] = IsEqual(); - eq[93][i].in[0] <== in[i]; - eq[93][i].in[1] <== 46; - eq[94][i] = IsEqual(); - eq[94][i].in[0] <== in[i]; - eq[94][i].in[1] <== 47; - eq[95][i] = IsEqual(); - eq[95][i].in[0] <== in[i]; - eq[95][i].in[1] <== 58; - eq[96][i] = IsEqual(); - eq[96][i].in[0] <== in[i]; - eq[96][i].in[1] <== 60; - eq[97][i] = IsEqual(); - eq[97][i].in[0] <== in[i]; - eq[97][i].in[1] <== 61; - eq[98][i] = IsEqual(); - eq[98][i].in[0] <== in[i]; - eq[98][i].in[1] <== 62; - eq[99][i] = IsEqual(); - eq[99][i].in[0] <== in[i]; - eq[99][i].in[1] <== 63; - eq[100][i] = IsEqual(); - eq[100][i].in[0] <== in[i]; - eq[100][i].in[1] <== 64; - and[11][i] = AND(); - and[11][i].a <== states[i][16]; - multi_or[4][i] = MultiOR(26); - multi_or[4][i].in[0] <== and[10][i].out; - multi_or[4][i].in[1] <== eq[76][i].out; - multi_or[4][i].in[2] <== eq[77][i].out; - multi_or[4][i].in[3] <== eq[78][i].out; - multi_or[4][i].in[4] <== eq[79][i].out; - multi_or[4][i].in[5] <== eq[80][i].out; - multi_or[4][i].in[6] <== eq[81][i].out; - multi_or[4][i].in[7] <== eq[82][i].out; - multi_or[4][i].in[8] <== eq[83][i].out; - multi_or[4][i].in[9] <== eq[84][i].out; - multi_or[4][i].in[10] <== eq[85][i].out; - multi_or[4][i].in[11] <== eq[86][i].out; - multi_or[4][i].in[12] <== eq[87][i].out; - multi_or[4][i].in[13] <== eq[88][i].out; - multi_or[4][i].in[14] <== eq[89][i].out; - multi_or[4][i].in[15] <== eq[90][i].out; - multi_or[4][i].in[16] <== eq[91][i].out; - multi_or[4][i].in[17] <== eq[92][i].out; - multi_or[4][i].in[18] <== eq[93][i].out; - multi_or[4][i].in[19] <== eq[94][i].out; - multi_or[4][i].in[20] <== eq[95][i].out; - multi_or[4][i].in[21] <== eq[96][i].out; - multi_or[4][i].in[22] <== eq[97][i].out; - multi_or[4][i].in[23] <== eq[98][i].out; - multi_or[4][i].in[24] <== eq[99][i].out; - multi_or[4][i].in[25] <== eq[100][i].out; - and[11][i].b <== multi_or[4][i].out; - lt[12][i] = LessThan(8); - lt[12][i].in[0] <== 64; - lt[12][i].in[1] <== in[i]; - lt[13][i] = LessThan(8); - lt[13][i].in[0] <== in[i]; - lt[13][i].in[1] <== 127; - and[12][i] = AND(); - and[12][i].a <== lt[12][i].out; - and[12][i].b <== lt[13][i].out; - eq[101][i] = IsEqual(); - eq[101][i].in[0] <== in[i]; - eq[101][i].in[1] <== 9; - eq[102][i] = IsEqual(); - eq[102][i].in[0] <== in[i]; - eq[102][i].in[1] <== 10; - eq[103][i] = IsEqual(); - eq[103][i].in[0] <== in[i]; - eq[103][i].in[1] <== 13; - eq[104][i] = IsEqual(); - eq[104][i].in[0] <== in[i]; - eq[104][i].in[1] <== 32; - eq[105][i] = IsEqual(); - eq[105][i].in[0] <== in[i]; - eq[105][i].in[1] <== 33; - eq[106][i] = IsEqual(); - eq[106][i].in[0] <== in[i]; - eq[106][i].in[1] <== 34; - eq[107][i] = IsEqual(); - eq[107][i].in[0] <== in[i]; - eq[107][i].in[1] <== 35; - eq[108][i] = IsEqual(); - eq[108][i].in[0] <== in[i]; - eq[108][i].in[1] <== 36; - eq[109][i] = IsEqual(); - eq[109][i].in[0] <== in[i]; - eq[109][i].in[1] <== 37; - eq[110][i] = IsEqual(); - eq[110][i].in[0] <== in[i]; - eq[110][i].in[1] <== 38; - eq[111][i] = IsEqual(); - eq[111][i].in[0] <== in[i]; - eq[111][i].in[1] <== 39; - eq[112][i] = IsEqual(); - eq[112][i].in[0] <== in[i]; - eq[112][i].in[1] <== 40; - eq[113][i] = IsEqual(); - eq[113][i].in[0] <== in[i]; - eq[113][i].in[1] <== 41; - eq[114][i] = IsEqual(); - eq[114][i].in[0] <== in[i]; - eq[114][i].in[1] <== 42; - eq[115][i] = IsEqual(); - eq[115][i].in[0] <== in[i]; - eq[115][i].in[1] <== 43; - eq[116][i] = IsEqual(); - eq[116][i].in[0] <== in[i]; - eq[116][i].in[1] <== 44; - eq[117][i] = IsEqual(); - eq[117][i].in[0] <== in[i]; - eq[117][i].in[1] <== 45; - eq[118][i] = IsEqual(); - eq[118][i].in[0] <== in[i]; - eq[118][i].in[1] <== 46; - eq[119][i] = IsEqual(); - eq[119][i].in[0] <== in[i]; - eq[119][i].in[1] <== 47; - eq[120][i] = IsEqual(); - eq[120][i].in[0] <== in[i]; - eq[120][i].in[1] <== 58; - eq[121][i] = IsEqual(); - eq[121][i].in[0] <== in[i]; - eq[121][i].in[1] <== 60; - eq[122][i] = IsEqual(); - eq[122][i].in[0] <== in[i]; - eq[122][i].in[1] <== 61; - eq[123][i] = IsEqual(); - eq[123][i].in[0] <== in[i]; - eq[123][i].in[1] <== 62; - eq[124][i] = IsEqual(); - eq[124][i].in[0] <== in[i]; - eq[124][i].in[1] <== 63; - eq[125][i] = IsEqual(); - eq[125][i].in[0] <== in[i]; - eq[125][i].in[1] <== 64; - and[13][i] = AND(); - and[13][i].a <== states[i][21]; - multi_or[5][i] = MultiOR(26); - multi_or[5][i].in[0] <== and[12][i].out; - multi_or[5][i].in[1] <== eq[101][i].out; - multi_or[5][i].in[2] <== eq[102][i].out; - multi_or[5][i].in[3] <== eq[103][i].out; - multi_or[5][i].in[4] <== eq[104][i].out; - multi_or[5][i].in[5] <== eq[105][i].out; - multi_or[5][i].in[6] <== eq[106][i].out; - multi_or[5][i].in[7] <== eq[107][i].out; - multi_or[5][i].in[8] <== eq[108][i].out; - multi_or[5][i].in[9] <== eq[109][i].out; - multi_or[5][i].in[10] <== eq[110][i].out; - multi_or[5][i].in[11] <== eq[111][i].out; - multi_or[5][i].in[12] <== eq[112][i].out; - multi_or[5][i].in[13] <== eq[113][i].out; - multi_or[5][i].in[14] <== eq[114][i].out; - multi_or[5][i].in[15] <== eq[115][i].out; - multi_or[5][i].in[16] <== eq[116][i].out; - multi_or[5][i].in[17] <== eq[117][i].out; - multi_or[5][i].in[18] <== eq[118][i].out; - multi_or[5][i].in[19] <== eq[119][i].out; - multi_or[5][i].in[20] <== eq[120][i].out; - multi_or[5][i].in[21] <== eq[121][i].out; - multi_or[5][i].in[22] <== eq[122][i].out; - multi_or[5][i].in[23] <== eq[123][i].out; - multi_or[5][i].in[24] <== eq[124][i].out; - multi_or[5][i].in[25] <== eq[125][i].out; - and[13][i].b <== multi_or[5][i].out; - multi_or[6][i] = MultiOR(4); - multi_or[6][i].in[0] <== and[6][i].out; - multi_or[6][i].in[1] <== and[9][i].out; - multi_or[6][i].in[2] <== and[11][i].out; - multi_or[6][i].in[3] <== and[13][i].out; - states[i+1][3] <== multi_or[6][i].out; - state_changed[i].in[2] <== states[i+1][3]; - eq[126][i] = IsEqual(); - eq[126][i].in[0] <== in[i]; - eq[126][i].in[1] <== 100; - and[14][i] = AND(); - and[14][i].a <== states[i][0]; - and[14][i].b <== eq[126][i].out; - states[i+1][4] <== and[14][i].out; - state_changed[i].in[3] <== states[i+1][4]; - eq[127][i] = IsEqual(); - eq[127][i].in[0] <== in[i]; - eq[127][i].in[1] <== 107; - and[15][i] = AND(); - and[15][i].a <== states[i][4]; - and[15][i].b <== eq[127][i].out; - states[i+1][5] <== and[15][i].out; - state_changed[i].in[4] <== states[i+1][5]; - eq[128][i] = IsEqual(); - eq[128][i].in[0] <== in[i]; - eq[128][i].in[1] <== 105; - and[16][i] = AND(); - and[16][i].a <== states[i][5]; - and[16][i].b <== eq[128][i].out; - states[i+1][6] <== and[16][i].out; - state_changed[i].in[5] <== states[i+1][6]; - eq[129][i] = IsEqual(); - eq[129][i].in[0] <== in[i]; - eq[129][i].in[1] <== 109; - and[17][i] = AND(); - and[17][i].a <== states[i][6]; - and[17][i].b <== eq[129][i].out; - states[i+1][7] <== and[17][i].out; - state_changed[i].in[6] <== states[i+1][7]; - eq[130][i] = IsEqual(); - eq[130][i].in[0] <== in[i]; - eq[130][i].in[1] <== 45; - and[18][i] = AND(); - and[18][i].a <== states[i][7]; - and[18][i].b <== eq[130][i].out; - states[i+1][8] <== and[18][i].out; - state_changed[i].in[7] <== states[i+1][8]; - eq[131][i] = IsEqual(); - eq[131][i].in[0] <== in[i]; - eq[131][i].in[1] <== 59; - and[19][i] = AND(); - and[19][i].a <== states[i][3]; - and[19][i].b <== eq[131][i].out; - states[i+1][9] <== and[19][i].out; - state_changed[i].in[8] <== states[i+1][9]; - eq[132][i] = IsEqual(); - eq[132][i].in[0] <== in[i]; - eq[132][i].in[1] <== 115; - and[20][i] = AND(); - and[20][i].a <== states[i][8]; - and[20][i].b <== eq[132][i].out; - states[i+1][10] <== and[20][i].out; - state_changed[i].in[9] <== states[i+1][10]; - eq[133][i] = IsEqual(); - eq[133][i].in[0] <== in[i]; - eq[133][i].in[1] <== 105; - and[21][i] = AND(); - and[21][i].a <== states[i][10]; - and[21][i].b <== eq[133][i].out; - states[i+1][11] <== and[21][i].out; - state_changed[i].in[10] <== states[i+1][11]; - eq[134][i] = IsEqual(); - eq[134][i].in[0] <== in[i]; - eq[134][i].in[1] <== 103; + lt[11][i].in[1] <== 58; and[22][i] = AND(); - and[22][i].a <== states[i][11]; - and[22][i].b <== eq[134][i].out; - states[i+1][12] <== and[22][i].out; - state_changed[i].in[11] <== states[i+1][12]; - eq[135][i] = IsEqual(); - eq[135][i].in[0] <== in[i]; - eq[135][i].in[1] <== 32; + and[22][i].a <== lt[10][i].out; + and[22][i].b <== lt[11][i].out; and[23][i] = AND(); - and[23][i].a <== states[i][9]; - and[23][i].b <== eq[135][i].out; - eq[136][i] = IsEqual(); - eq[136][i].in[0] <== in[i]; - eq[136][i].in[1] <== 32; + and[23][i].a <== states[i][12]; + and[23][i].b <== and[22][i].out; + multi_or[5][i] = MultiOR(2); + multi_or[5][i].in[0] <== and[21][i].out; + multi_or[5][i].in[1] <== and[23][i].out; + states[i+1][12] <== multi_or[5][i].out; + state_changed[i].in[11] <== states[i+1][12]; + eq[37][i] = IsEqual(); + eq[37][i].in[0] <== in[i]; + eq[37][i].in[1] <== 59; and[24][i] = AND(); - and[24][i].a <== states[i][24]; - and[24][i].b <== eq[136][i].out; - multi_or[7][i] = MultiOR(2); - multi_or[7][i].in[0] <== and[23][i].out; - multi_or[7][i].in[1] <== and[24][i].out; - states[i+1][13] <== multi_or[7][i].out; + and[24][i].a <== states[i][12]; + and[24][i].b <== eq[37][i].out; + states[i+1][13] <== and[24][i].out; state_changed[i].in[12] <== states[i+1][13]; - eq[137][i] = IsEqual(); - eq[137][i].in[0] <== in[i]; - eq[137][i].in[1] <== 110; + eq[38][i] = IsEqual(); + eq[38][i].in[0] <== in[i]; + eq[38][i].in[1] <== 45; and[25][i] = AND(); - and[25][i].a <== states[i][12]; - and[25][i].b <== eq[137][i].out; + and[25][i].a <== states[i][11]; + and[25][i].b <== eq[38][i].out; states[i+1][14] <== and[25][i].out; state_changed[i].in[13] <== states[i+1][14]; - eq[138][i] = IsEqual(); - eq[138][i].in[0] <== in[i]; - eq[138][i].in[1] <== 116; + eq[39][i] = IsEqual(); + eq[39][i].in[0] <== in[i]; + eq[39][i].in[1] <== 115; and[26][i] = AND(); - and[26][i].a <== states[i][13]; - and[26][i].b <== eq[138][i].out; + and[26][i].a <== states[i][14]; + and[26][i].b <== eq[39][i].out; states[i+1][15] <== and[26][i].out; state_changed[i].in[14] <== states[i+1][15]; - eq[139][i] = IsEqual(); - eq[139][i].in[0] <== in[i]; - eq[139][i].in[1] <== 61; + eq[40][i] = IsEqual(); + eq[40][i].in[0] <== in[i]; + eq[40][i].in[1] <== 105; and[27][i] = AND(); and[27][i].a <== states[i][15]; - and[27][i].b <== eq[139][i].out; + and[27][i].b <== eq[40][i].out; states[i+1][16] <== and[27][i].out; state_changed[i].in[15] <== states[i+1][16]; - eq[140][i] = IsEqual(); - eq[140][i].in[0] <== in[i]; - eq[140][i].in[1] <== 97; + eq[41][i] = IsEqual(); + eq[41][i].in[0] <== in[i]; + eq[41][i].in[1] <== 103; and[28][i] = AND(); - and[28][i].a <== states[i][14]; - and[28][i].b <== eq[140][i].out; + and[28][i].a <== states[i][16]; + and[28][i].b <== eq[41][i].out; states[i+1][17] <== and[28][i].out; state_changed[i].in[16] <== states[i+1][17]; - eq[141][i] = IsEqual(); - eq[141][i].in[0] <== in[i]; - eq[141][i].in[1] <== 116; + eq[42][i] = IsEqual(); + eq[42][i].in[0] <== in[i]; + eq[42][i].in[1] <== 110; and[29][i] = AND(); and[29][i].a <== states[i][17]; - and[29][i].b <== eq[141][i].out; + and[29][i].b <== eq[42][i].out; states[i+1][18] <== and[29][i].out; state_changed[i].in[17] <== states[i+1][18]; - eq[142][i] = IsEqual(); - eq[142][i].in[0] <== in[i]; - eq[142][i].in[1] <== 117; + eq[43][i] = IsEqual(); + eq[43][i].in[0] <== in[i]; + eq[43][i].in[1] <== 97; and[30][i] = AND(); and[30][i].a <== states[i][18]; - and[30][i].b <== eq[142][i].out; + and[30][i].b <== eq[43][i].out; states[i+1][19] <== and[30][i].out; state_changed[i].in[18] <== states[i+1][19]; - eq[143][i] = IsEqual(); - eq[143][i].in[0] <== in[i]; - eq[143][i].in[1] <== 114; + eq[44][i] = IsEqual(); + eq[44][i].in[0] <== in[i]; + eq[44][i].in[1] <== 116; and[31][i] = AND(); and[31][i].a <== states[i][19]; - and[31][i].b <== eq[143][i].out; + and[31][i].b <== eq[44][i].out; states[i+1][20] <== and[31][i].out; state_changed[i].in[19] <== states[i+1][20]; - lt[14][i] = LessThan(8); - lt[14][i].in[0] <== 47; - lt[14][i].in[1] <== in[i]; - lt[15][i] = LessThan(8); - lt[15][i].in[0] <== in[i]; - lt[15][i].in[1] <== 58; + eq[45][i] = IsEqual(); + eq[45][i].in[0] <== in[i]; + eq[45][i].in[1] <== 117; and[32][i] = AND(); - and[32][i].a <== lt[14][i].out; - and[32][i].b <== lt[15][i].out; - and[33][i] = AND(); - and[33][i].a <== states[i][16]; - and[33][i].b <== and[32][i].out; - lt[16][i] = LessThan(8); - lt[16][i].in[0] <== 47; - lt[16][i].in[1] <== in[i]; - lt[17][i] = LessThan(8); - lt[17][i].in[0] <== in[i]; - lt[17][i].in[1] <== 58; - and[34][i] = AND(); - and[34][i].a <== lt[16][i].out; - and[34][i].b <== lt[17][i].out; - and[35][i] = AND(); - and[35][i].a <== states[i][21]; - and[35][i].b <== and[34][i].out; - multi_or[8][i] = MultiOR(2); - multi_or[8][i].in[0] <== and[33][i].out; - multi_or[8][i].in[1] <== and[35][i].out; - states[i+1][21] <== multi_or[8][i].out; + and[32][i].a <== states[i][20]; + and[32][i].b <== eq[45][i].out; + states[i+1][21] <== and[32][i].out; state_changed[i].in[20] <== states[i+1][21]; - eq[144][i] = IsEqual(); - eq[144][i].in[0] <== in[i]; - eq[144][i].in[1] <== 101; - and[36][i] = AND(); - and[36][i].a <== states[i][20]; - and[36][i].b <== eq[144][i].out; - states[i+1][22] <== and[36][i].out; + eq[46][i] = IsEqual(); + eq[46][i].in[0] <== in[i]; + eq[46][i].in[1] <== 114; + and[33][i] = AND(); + and[33][i].a <== states[i][21]; + and[33][i].b <== eq[46][i].out; + states[i+1][22] <== and[33][i].out; state_changed[i].in[21] <== states[i+1][22]; - eq[145][i] = IsEqual(); - eq[145][i].in[0] <== in[i]; - eq[145][i].in[1] <== 58; - and[37][i] = AND(); - and[37][i].a <== states[i][22]; - and[37][i].b <== eq[145][i].out; - states[i+1][23] <== and[37][i].out; + eq[47][i] = IsEqual(); + eq[47][i].in[0] <== in[i]; + eq[47][i].in[1] <== 101; + and[34][i] = AND(); + and[34][i].a <== states[i][22]; + and[34][i].b <== eq[47][i].out; + states[i+1][23] <== and[34][i].out; state_changed[i].in[22] <== states[i+1][23]; - eq[146][i] = IsEqual(); - eq[146][i].in[0] <== in[i]; - eq[146][i].in[1] <== 59; - and[38][i] = AND(); - and[38][i].a <== states[i][21]; - and[38][i].b <== eq[146][i].out; - states[i+1][24] <== and[38][i].out; + eq[48][i] = IsEqual(); + eq[48][i].in[0] <== in[i]; + eq[48][i].in[1] <== 58; + and[35][i] = AND(); + and[35][i].a <== states[i][23]; + and[35][i].b <== eq[48][i].out; + states[i+1][24] <== and[35][i].out; state_changed[i].in[23] <== states[i+1][24]; states[i+1][0] <== 1 - state_changed[i].out; } component final_state_result = MultiOR(num_bytes+1); for (var i = 0; i <= num_bytes; i++) { - final_state_result.in[i] <== states[i][24]; + final_state_result.in[i] <== states[i][13]; } out <== final_state_result.out; signal is_consecutive[msg_bytes+1][2]; is_consecutive[msg_bytes][1] <== 1; for (var i = 0; i < msg_bytes; i++) { - is_consecutive[msg_bytes-1-i][0] <== states[num_bytes-i][24] * (1 - is_consecutive[msg_bytes-i][1]) + is_consecutive[msg_bytes-i][1]; + is_consecutive[msg_bytes-1-i][0] <== states[num_bytes-i][13] * (1 - is_consecutive[msg_bytes-i][1]) + is_consecutive[msg_bytes-i][1]; is_consecutive[msg_bytes-1-i][1] <== state_changed[msg_bytes-i].out * is_consecutive[msg_bytes-1-i][0]; } signal is_substr0[msg_bytes][3]; @@ -857,8 +429,8 @@ template TimestampRegex(msg_bytes) { signal output reveal0[msg_bytes]; for (var i = 0; i < msg_bytes; i++) { is_substr0[i][0] <== 0; - is_substr0[i][1] <== is_substr0[i][0] + states[i+1][21] * states[i+2][21]; - is_substr0[i][2] <== is_substr0[i][1] + states[i+1][16] * states[i+2][21]; + is_substr0[i][1] <== is_substr0[i][0] + states[i+1][10] * states[i+2][12]; + is_substr0[i][2] <== is_substr0[i][1] + states[i+1][12] * states[i+2][12]; is_reveal0[i] <== is_substr0[i][2] * is_consecutive[i][1]; reveal0[i] <== in[i+1] * is_reveal0[i]; }