From 946b50ebfe10686fdd41f7d49d41213c5e0845a3 Mon Sep 17 00:00:00 2001 From: ying tong Date: Thu, 18 Mar 2021 11:41:42 +0800 Subject: [PATCH] Add documentation Co-authored-by: str4d --- src/primitives/sinsemilla.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 {