Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] enable accessing of table16 #75

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading