-
Notifications
You must be signed in to change notification settings - Fork 37
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
1 parent
a03ee87
commit 77d1a13
Showing
2 changed files
with
38 additions
and
0 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub(crate) mod ecc; | ||
pub(crate) mod sinsemilla; |
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,37 @@ | ||
//! Gadget and chips for the Sinsemilla hash function. | ||
use halo2::{ | ||
arithmetic::CurveAffine, | ||
circuit::{Chip, Layouter}, | ||
plonk::Error, | ||
}; | ||
|
||
/// The set of circuit instructions required to use the [`Sinsemilla`](https://zcash.github.io/halo2/design/gadgets/sinsemilla.html) gadget. | ||
pub trait SinsemillaInstructions<C: CurveAffine>: Chip<Field = C::Base> { | ||
type Message: IntoIterator<Item = bool>; | ||
|
||
fn extract(point: &C::Curve) -> C::Base; | ||
|
||
#[allow(non_snake_case)] | ||
fn Q(domain_prefix: &str) -> C::CurveExt; | ||
|
||
fn hash_to_point( | ||
layouter: &mut impl Layouter<Self>, | ||
domain_prefix: &str, | ||
message: Self::Message, | ||
) -> Result<C, Error>; | ||
|
||
fn hash( | ||
layouter: &mut impl Layouter<Self>, | ||
domain_prefix: &str, | ||
message: Self::Message, | ||
) -> Result<C::Base, Error>; | ||
|
||
fn commit(domain_prefix: &str, msg: Self::Message, r: &C::Scalar) | ||
-> Result<C::CurveExt, Error>; | ||
|
||
fn short_commit( | ||
domain_prefix: &str, | ||
msg: Self::Message, | ||
r: &C::Scalar, | ||
) -> Result<C::Base, Error>; | ||
} |