Skip to content

Commit

Permalink
enable accessing for table16 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
noel2004 authored Nov 30, 2023
1 parent 5f758e0 commit 5b9a3d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 4 additions & 1 deletion halo2_gadgets/benches/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ use std::{

use criterion::{criterion_group, criterion_main, Criterion};

use halo2_gadgets::sha256::{BlockWord, Sha256, Table16Chip, Table16Config, BLOCK_SIZE};
use halo2_gadgets::sha256::{
table16::{BlockWord, Table16Chip, Table16Config},
Sha256, BLOCK_SIZE,
};

use halo2_proofs::{
poly::{
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

pub mod ecc;
pub mod poseidon;
//#[cfg(feature = "unstable")]
//#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
#[cfg(feature = "unstable")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
pub mod sha256;
pub mod sinsemilla;
pub mod utilities;
5 changes: 2 additions & 3 deletions halo2_gadgets/src/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ use halo2_proofs::{
plonk::Error,
};

mod table16;

pub use table16::{BlockWord, Table16Chip, Table16Config};
/// The core circuit for SHA256
pub mod table16;

/// The size of a SHA-256 block, in 32-bit words.
pub const BLOCK_SIZE: usize = 16;
Expand Down
12 changes: 8 additions & 4 deletions halo2_gadgets/src/sha256/table16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ pub struct Table16Config {
}

impl Table16Config {
pub(crate) fn initialize<F: Field>(
/// export initialize of compression module
pub fn initialize<F: Field>(
&self,
layouter: &mut impl Layouter<F>,
init_state_assigned: [RoundWordDense<F>; STATE],
) -> Result<State<F>, Error> {
self.compression.initialize(layouter, init_state_assigned)
}

pub(crate) fn compress<F: Field>(
/// export compress of compression module
pub fn compress<F: Field>(
&self,
layouter: &mut impl Layouter<F>,
initialized_state: State<F>,
Expand All @@ -252,7 +254,8 @@ impl Table16Config {
.compress(layouter, initialized_state, w_halves)
}

pub(crate) fn digest<F: Field>(
/// export digest of compression module
pub fn digest<F: Field>(
&self,
layouter: &mut impl Layouter<F>,
final_state: State<F>,
Expand All @@ -262,8 +265,9 @@ impl Table16Config {
.digest(layouter, final_state, initialized_state)
}

/// export message_process module
#[allow(clippy::type_complexity)]
pub(crate) fn message_process<F: Field>(
pub fn message_process<F: Field>(
&self,
layouter: &mut impl Layouter<F>,
input: [BlockWord; super::BLOCK_SIZE],
Expand Down

0 comments on commit 5b9a3d7

Please sign in to comment.