Skip to content

Commit

Permalink
finish layout of witness for keccak
Browse files Browse the repository at this point in the history
  • Loading branch information
querolita committed Oct 19, 2023
1 parent 5ca1dc4 commit 5823a90
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions kimchi/src/circuits/polynomials/keccak/witness.rs
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
//! Foreign field multiplication witness computation
use crate::{
auto_clone_array,
circuits::{
polynomial::COLUMNS,
polynomials::{foreign_field_add, range_check},
witness::{self, ConstantCell, VariableBitsCell, VariableCell, Variables, WitnessCell},
},
variable_map,
};
use crate::circuits::witness::{IndexCell, WitnessCell};
use ark_ff::PrimeField;
use num_bigint::BigUint;
use num_integer::Integer;

use num_traits::One;
use o1_utils::foreign_field::{
BigUintArrayFieldHelpers, BigUintForeignFieldHelpers, FieldArrayBigUintHelpers,
ForeignFieldHelpers,
};
use std::{array, ops::Div};
use super::KECCAK_COLS;

use super::circuitgates;
type _Layout<const N: usize, F> = Vec<Box<dyn WitnessCell<N, F, Vec<F>>>>;

const ROUND_COLS: usize = 2344;
const SPONGE_COLS: usize = 312;
/*
fn create_layout_round<F: PrimeField>() -> [[Box<dyn WitnessCell<F>>; ROUND_COLS]; 1] {
[ArrayCell::create("state_a")
ArrayCell::create("state_c")
ArrayCell::create("reset_c")
ArrayCell::create("dense_c")
ArrayCell::create("quotient_c")
ArrayCell::create("remainder_c")
ArrayCell::create("bound_c")
ArrayCell::create("dense_rot_c")
ArrayCell::create("expand_rot_c")
ArrayCell::create("state_d")
ArrayCell::create("state_e")
ArrayCell::create("reset_e")
ArrayCell::create("dense_e")
ArrayCell::create("quotient_e")
ArrayCell::create("remainder_e")
ArrayCell::create("bound_e")
ArrayCell::create("dense_rot_e")
ArrayCell::create("expand_rot_e")
ArrayCell::create("state_b")
ArrayCell::create("reset_b")
ArrayCell::create("reset_sum")
ArrayCell::create("f00")
fn _layout_round<F: PrimeField>() -> _Layout<KECCAK_COLS, F> {
vec![
IndexCell::create("state_a", 0, 100),
IndexCell::create("state_c", 100, 120),
IndexCell::create("shifts_c", 120, 200),
IndexCell::create("dense_c", 200, 220),
IndexCell::create("quotient_c", 220, 240),
IndexCell::create("remainder_c", 240, 260),
IndexCell::create("bound_c", 260, 280),
IndexCell::create("dense_rot_c", 280, 300),
IndexCell::create("expand_rot_c", 300, 320),
IndexCell::create("state_d", 320, 340),
IndexCell::create("state_e", 340, 440),
IndexCell::create("shifts_e", 440, 840),
IndexCell::create("dense_e", 840, 940),
IndexCell::create("quotient_e", 940, 1040),
IndexCell::create("remainder_e", 1040, 1140),
IndexCell::create("bound_e", 1140, 1240),
IndexCell::create("dense_rot_e", 1240, 1340),
IndexCell::create("expand_rot_e", 1340, 1440),
IndexCell::create("state_b", 1440, 1540),
IndexCell::create("shifts_b", 1540, 1940),
IndexCell::create("shifts_sum", 1940, 2340),
IndexCell::create("f00", 2340, 2344),
]
}

fn _layout_sponge<F: PrimeField>() -> _Layout<KECCAK_COLS, F> {
vec![
IndexCell::create("old_state", 0, 100),
IndexCell::create("new_state", 100, 200),
IndexCell::create("dense", 200, 300),
IndexCell::create("bytes", 300, 500),
IndexCell::create("shifts", 500, 900),
]
}
*/

0 comments on commit 5823a90

Please sign in to comment.