mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Add example to hash_to_curve doc comment.
This commit is contained in:
parent
dc069dff31
commit
b488355e13
1 changed files with 13 additions and 1 deletions
|
|
@ -80,9 +80,21 @@ pub trait Curve:
|
|||
fn jacobian_coordinates(&self) -> (Self::Base, Self::Base, Self::Base);
|
||||
|
||||
/// Requests a hasher that accepts messages and returns near-uniformly
|
||||
/// distributed elements in the group, given domain prefix `hasher`.
|
||||
/// distributed elements in the group, given domain prefix `domain_prefix`.
|
||||
///
|
||||
/// This method is suitable for use as a random oracle.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use halo2::arithmetic::{Curve, CurveAffine};
|
||||
/// fn pedersen_commitment<C: CurveAffine>(x: C::Scalar, r: C::Scalar) -> C {
|
||||
/// let hasher = C::Projective::hash_to_curve("z.cash:example_pedersen_commitment");
|
||||
/// let g = hasher(b"g");
|
||||
/// let h = hasher(b"h");
|
||||
/// (g * x + h * r).to_affine()
|
||||
/// }
|
||||
/// ```
|
||||
fn hash_to_curve(domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static>;
|
||||
|
||||
/// Returns whether or not this element is on the curve; should
|
||||
|
|
|
|||
Loading…
Reference in a new issue