From fceeb027b8ae8f1a78a7407f044df7056c91ba44 Mon Sep 17 00:00:00 2001 From: yash1io Date: Sat, 3 Aug 2024 17:32:35 +0530 Subject: [PATCH] bump version and fix tbox --- circomkit.json | 2 +- circuits/cipher.circom | 2 +- circuits/ctr.circom | 2 +- circuits/key_expansion.circom | 2 +- circuits/mix_columns.circom | 18 +++++++++--------- circuits/sbox128.circom | 2 +- circuits/tbox.circom | 4 ++-- circuits/transformations.circom | 2 +- circuits/utils.circom | 2 +- tests/tbox.test.ts | 15 --------------- 10 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 tests/tbox.test.ts diff --git a/circomkit.json b/circomkit.json index cd5fed7..bdc8e25 100644 --- a/circomkit.json +++ b/circomkit.json @@ -1,5 +1,5 @@ { - "version": "2.1.8", + "version": "2.1.9", "proofSystem": "groth16", "curve": "bn128" } diff --git a/circuits/cipher.circom b/circuits/cipher.circom index 50b806f..ee8a9c1 100644 --- a/circuits/cipher.circom +++ b/circuits/cipher.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "key_expansion.circom"; include "circomlib/circuits/comparators.circom"; diff --git a/circuits/ctr.circom b/circuits/ctr.circom index 696d295..c388d99 100644 --- a/circuits/ctr.circom +++ b/circuits/ctr.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "cipher.circom"; include "transformations.circom"; diff --git a/circuits/key_expansion.circom b/circuits/key_expansion.circom index 5686474..81c8c14 100644 --- a/circuits/key_expansion.circom +++ b/circuits/key_expansion.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "sbox128.circom"; include "utils.circom"; diff --git a/circuits/mix_columns.circom b/circuits/mix_columns.circom index 5e81db8..ec8ff70 100644 --- a/circuits/mix_columns.circom +++ b/circuits/mix_columns.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "transformations.circom"; include "circomlib/circuits/comparators.circom"; @@ -55,10 +55,10 @@ template S0(){ } num2bits[0] = Num2Bits(8); - num2bits[0].in <-- TBox(2, in[0]); + num2bits[0].in <-- TBox(0, in[0]); num2bits[1] = Num2Bits(8); - num2bits[1].in <-- TBox(3, in[1]); + num2bits[1].in <-- TBox(1, in[1]); xor[0] = XorBits(); xor[0].a <== num2bits[0].out; @@ -92,10 +92,10 @@ template S1(){ num2bits[0].in <== in[0]; num2bits[1] = Num2Bits(8); - num2bits[1].in <-- TBox(2, in[1]); + num2bits[1].in <-- TBox(0, in[1]); num2bits[2] = Num2Bits(8); - num2bits[2].in <-- TBox(3, in[2]); + num2bits[2].in <-- TBox(1, in[2]); num2bits[3] = Num2Bits(8); num2bits[3].in <== in[3]; @@ -134,10 +134,10 @@ template S2() { } num2bits[2] = Num2Bits(8); - num2bits[2].in <-- TBox(2, in[2]); + num2bits[2].in <-- TBox(0, in[2]); num2bits[3] = Num2Bits(8); - num2bits[3].in <-- TBox(3, in[3]); + num2bits[3].in <-- TBox(1, in[3]); xor[0] = XorBits(); xor[0].a <== num2bits[0].out; @@ -173,10 +173,10 @@ template S3() { } num2bits[0] = Num2Bits(8); - num2bits[0].in <-- TBox(3, in[0]); + num2bits[0].in <-- TBox(1, in[0]); num2bits[3] = Num2Bits(8); - num2bits[3].in <-- TBox(2, in[3]); + num2bits[3].in <-- TBox(0, in[3]); xor[0] = XorBits(); xor[0].a <== num2bits[0].out; diff --git a/circuits/sbox128.circom b/circuits/sbox128.circom index b1dba34..c949f0e 100644 --- a/circuits/sbox128.circom +++ b/circuits/sbox128.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "circomlib/circuits/comparators.circom"; diff --git a/circuits/tbox.circom b/circuits/tbox.circom index a2bc12c..976fbea 100644 --- a/circuits/tbox.circom +++ b/circuits/tbox.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "transformations.circom"; include "circomlib/circuits/bitify.circom"; @@ -6,7 +6,7 @@ include "circomlib/circuits/bitify.circom"; //tbox[0] =>> multiplication by 2 //tbox[1] =>> multiplication by 3 function TBox(index, subbyte) { - var tbox[2][16*16] = [ + var tbox[2][256] = [ [ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, diff --git a/circuits/transformations.circom b/circuits/transformations.circom index f3b83e9..3120e52 100644 --- a/circuits/transformations.circom +++ b/circuits/transformations.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "circomlib/circuits/comparators.circom"; include "circomlib/circuits/bitify.circom"; diff --git a/circuits/utils.circom b/circuits/utils.circom index 26a4ea3..d9b6bea 100644 --- a/circuits/utils.circom +++ b/circuits/utils.circom @@ -1,4 +1,4 @@ -pragma circom 2.1.8; +pragma circom 2.1.9; include "sbox128.circom"; include "circomlib/circuits/comparators.circom"; diff --git a/tests/tbox.test.ts b/tests/tbox.test.ts deleted file mode 100644 index 6800ef3..0000000 --- a/tests/tbox.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -// import { WitnessTester } from "circomkit"; -// import { circomkit } from "./common"; - -// describe.only("TBox", () => { -// let circuit: WitnessTester; - -// it("should compute correctly", async () => { -// circuit = await circomkit.WitnessTester(`TBox`, { -// file: "tbox", -// template: "TBox", -// params: [0, 3], -// }); -// console.log("#constraints:", await circuit.getConstraintCount()); -// }); -// });