forked from zcash/halo2
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
adria0
committed
Jun 6, 2024
1 parent
b4d1c4c
commit 9ea833d
Showing
18 changed files
with
214 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ members = [ | |
"halo2_frontend", | ||
"halo2_middleware", | ||
"halo2_backend", | ||
"halo2_debug", | ||
"p3_frontend", | ||
] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "halo2_debug" | ||
version = "0.3.0" | ||
authors = [ | ||
"Privacy Scaling Explorations team", | ||
] | ||
edition = "2021" | ||
rust-version = "1.66.0" | ||
description = """ | ||
Halo2 Debug. This package contains utilities for debugging and testing within | ||
the halo2 ecosystem. | ||
""" | ||
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/privacy-scaling-explorations/halo2" | ||
documentation = "https://privacy-scaling-explorations.github.io/halo2/" | ||
categories = ["cryptography"] | ||
keywords = ["halo", "proofs", "zkp", "zkSNARKs"] | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"] | ||
|
||
[dependencies] | ||
tiny-keccak = { version = "2.0.2", features=["keccak"] } | ||
hex = "0.4.3" | ||
rand_core = "0.6.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use rand_core::block::BlockRng; | ||
use rand_core::block::BlockRngCore; | ||
use tiny_keccak::Hasher; | ||
|
||
/// One number generator, that can be used as a deterministic Rng, outputing fixed values. | ||
pub struct OneNg {} | ||
|
||
impl BlockRngCore for OneNg { | ||
type Item = u32; | ||
type Results = [u32; 16]; | ||
|
||
fn generate(&mut self, results: &mut Self::Results) { | ||
for elem in results.iter_mut() { | ||
*elem = 1; | ||
} | ||
} | ||
} | ||
|
||
pub fn one_rng() -> BlockRng<OneNg> { | ||
BlockRng::<OneNg>::new(OneNg {}) | ||
} | ||
|
||
/// Gets the hex representation of the keccak hash of the input data | ||
pub fn keccak_hex<D: AsRef<[u8]>>(data: D) -> String { | ||
let mut hash = [0u8; 32]; | ||
let mut hasher = tiny_keccak::Keccak::v256(); | ||
hasher.update(data.as_ref()); | ||
hasher.finalize(&mut hash); | ||
hex::encode(hash) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.