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

feat: add u32 related hash functions #27

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

kevjue
Copy link
Contributor

@kevjue kevjue commented Feb 27, 2024

No description provided.

// Perform rejection sampling over the uniform range (0..log2_ceil(p))
let sample_base = |inner: &mut Inner| loop {
let log_size = log2_ceil_u64(F::ORDER_U64).saturating_sub(1);
let bound = (1 << log_size) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plonky3 sampling uses rejection sampling (probably changes since the last time you update the branch), so we should keep that in our versions as well

@@ -35,3 +35,35 @@ impl CryptographicHasher<u8, [u8; 32]> for Blake3 {
hasher.finalize().into()
}
}

impl CryptographicHasher<u32, [u32; 8]> for Blake3 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should have another struct Blake3zk or something that uses our precompiles, it could even be in the sp1 recursion crate. The reason is that we would eventually want the normal Blake3 to implement hashing on u32 (this might be useful for SIMD utilization. of the prover)

challenger/src/serializing_challenger.rs Show resolved Hide resolved
Copy link
Contributor

@tamirhemo tamirhemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tamirhemo tamirhemo merged commit 447c01e into main Feb 28, 2024
3 checks passed
huitseeker added a commit to huitseeker/sp1 that referenced this pull request Feb 29, 2024
- succinctlabs/plonky3#27 updated `SerializingChallenger32` to take a type parameter for an initial `HashChallenger` state,
- Updates the `Challenger` type definition in the `baby_bear_keccak` and `baby_bear_blake3` modules to reflect what typed is used there (u8).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants