diff --git a/src/primitives/sinsemilla.rs b/src/primitives/sinsemilla.rs index 6a0b1fb0..2a18f2f8 100644 --- a/src/primitives/sinsemilla.rs +++ b/src/primitives/sinsemilla.rs @@ -76,11 +76,21 @@ impl> Iterator for Pad { } } +/// Trait representing a domain in which [`sinsemilla::hash_to_point`] and +/// [`sinsemilla::hash`] can be used. +/// +/// [`sinsemilla::hash_to_point`]: self::hash_to_point +/// [`sinsemilla::hash`]: self::hash pub trait HashDomain { #[allow(non_snake_case)] fn Q(&self) -> pallas::Point; } +/// A domain with a specific prefix string, in which [`sinsemilla::hash_to_point`] and +/// [`sinsemilla::hash`] can be used. +/// +/// [`sinsemilla::hash_to_point`]: self::hash_to_point +/// [`sinsemilla::hash`]: self::hash pub struct Domain(pub &'static str); impl HashDomain for Domain { @@ -114,11 +124,21 @@ pub(crate) fn hash(domain: &D, msg: impl Iterator) - extract_p(&hash_to_point(domain, msg)) } +/// Trait representing a domain in which [`sinsemilla::commit`] and +/// [`sinsemilla::short_commit`] can be used. +/// +/// [`sinsemilla::commit`]: self::commit +/// [`sinsemilla::short_commit`]: self::short_commit pub trait CommitDomain: HashDomain { #[allow(non_snake_case)] fn R(&self) -> pallas::Point; } +/// A domain with a specific prefix string, in which [`sinsemilla::commit`] and +/// [`sinsemilla::short_commit`] can be used. +/// +/// [`sinsemilla::commit`]: self::commit +/// [`sinsemilla::short_commit`]: self::short_commit pub struct Comm(pub &'static str); impl HashDomain for Comm {