From 1a5980a11f84af1d807123e34be8b077c513eec1 Mon Sep 17 00:00:00 2001 From: Ho Vei Date: Thu, 30 Nov 2023 18:48:09 +0800 Subject: [PATCH] enable accessing for table16 --- halo2_gadgets/benches/sha256.rs | 5 ++++- halo2_gadgets/src/lib.rs | 4 ++-- halo2_gadgets/src/sha256.rs | 5 ++--- halo2_gadgets/src/sha256/table16.rs | 12 ++++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/halo2_gadgets/benches/sha256.rs b/halo2_gadgets/benches/sha256.rs index a702e84ebe..cb5b5c3194 100644 --- a/halo2_gadgets/benches/sha256.rs +++ b/halo2_gadgets/benches/sha256.rs @@ -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::{ diff --git a/halo2_gadgets/src/lib.rs b/halo2_gadgets/src/lib.rs index 446b16c5f6..8d4d4292b0 100644 --- a/halo2_gadgets/src/lib.rs +++ b/halo2_gadgets/src/lib.rs @@ -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; diff --git a/halo2_gadgets/src/sha256.rs b/halo2_gadgets/src/sha256.rs index 19a658df3a..499613ad18 100644 --- a/halo2_gadgets/src/sha256.rs +++ b/halo2_gadgets/src/sha256.rs @@ -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; diff --git a/halo2_gadgets/src/sha256/table16.rs b/halo2_gadgets/src/sha256/table16.rs index 33fb54f1a3..48a38ea5fb 100644 --- a/halo2_gadgets/src/sha256/table16.rs +++ b/halo2_gadgets/src/sha256/table16.rs @@ -234,7 +234,8 @@ pub struct Table16Config { } impl Table16Config { - pub(crate) fn initialize( + /// export initialize of compression module + pub fn initialize( &self, layouter: &mut impl Layouter, init_state_assigned: [RoundWordDense; STATE], @@ -242,7 +243,8 @@ impl Table16Config { self.compression.initialize(layouter, init_state_assigned) } - pub(crate) fn compress( + /// export compress of compression module + pub fn compress( &self, layouter: &mut impl Layouter, initialized_state: State, @@ -252,7 +254,8 @@ impl Table16Config { .compress(layouter, initialized_state, w_halves) } - pub(crate) fn digest( + /// export digest of compression module + pub fn digest( &self, layouter: &mut impl Layouter, final_state: State, @@ -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( + pub fn message_process( &self, layouter: &mut impl Layouter, input: [BlockWord; super::BLOCK_SIZE],