-
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
f9a089d
commit 8918160
Showing
3 changed files
with
44 additions
and
3 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,36 @@ | ||
//! 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: Iterator<Item = bool> + ExactSizeIterator; | ||
|
||
fn extract(point: &C::Curve) -> C::Base; | ||
|
||
#[allow(non_snake_case)] | ||
fn Q(domain_prefix: &str) -> C::Curve; | ||
|
||
fn hash_to_point( | ||
layouter: &mut impl Layouter<Self>, | ||
domain_prefix: &str, | ||
message: Self::Message, | ||
) -> Result<C::Curve, 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::Curve, Error>; | ||
|
||
fn short_commit( | ||
domain_prefix: &str, | ||
msg: Self::Message, | ||
r: &C::Scalar, | ||
) -> Result<C::Base, Error>; | ||
} |
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