Rename hasher to hash_to_curve.

This commit is contained in:
Sean Bowe 2021-02-02 12:33:41 -07:00 committed by Daira Hopwood
parent f6f008f905
commit dc069dff31
4 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,7 @@ pub trait Curve:
/// distributed elements in the group, given domain prefix `hasher`.
///
/// This method is suitable for use as a random oracle.
fn hasher(domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static>;
fn hash_to_curve(domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static>;
/// Returns whether or not this element is on the curve; should
/// always be true unless an "unchecked" API was used.

View File

@ -686,7 +686,7 @@ macro_rules! new_curve_impl {
macro_rules! impl_projective_curve_specific {
($name:ident, $name_affine:ident, $iso_affine:ident, $base:ident, special_a0_b5) => {
fn hasher(domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static> {
fn hash_to_curve(domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static> {
use super::hashtocurve;
let domain_separation_tag: String = format!(
@ -777,7 +777,7 @@ macro_rules! impl_projective_curve_specific {
};
($name:ident, $name_affine:ident, $iso_affine:ident, $base:ident, general) => {
/// Unimplemented: hashing to this curve is not supported
fn hasher(_domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static> {
fn hash_to_curve(_domain_prefix: &str) -> Box<dyn Fn(&[u8]) -> Self + 'static> {
unimplemented!()
}

View File

@ -24,7 +24,7 @@ pub type IsoAffine = IsoEpAffine;
fn test_map_to_curve_pallas() {
use crate::arithmetic::Curve;
let hash = Point::hasher("z.cash:test");
let hash = Point::hash_to_curve("z.cash:test");
let p: Point = hash(b"hello");
let (x, y, z) = p.jacobian_coordinates();
println!("{:?}", p);

View File

@ -24,7 +24,7 @@ pub type IsoAffine = IsoEqAffine;
fn test_map_to_curve_vesta() {
use crate::arithmetic::Curve;
let hash = Point::hasher("z.cash:test");
let hash = Point::hash_to_curve("z.cash:test");
let p: Point = hash(b"hello");
let (x, y, z) = p.jacobian_coordinates();
println!("{:?}", p);