[−][src]Struct hash2curve::DomainSeparationTag
Represents a domain separation tag suitable for use in
hash_to_curve
or encode_to_curve
functions as describe in section 3.1
in https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/?include_text=1
As an example, consider a fictional protocol named Quux that defines
several different ciphersuites. A reasonable choice of tag is "QUUX-
V
As another example, consider a fictional protocol named Baz that
requires two independent random oracles, where one oracle outputs
points on the curve E1 and the other outputs points on the curve E2.
Reasonable choices of tags for the E1 and E2 oracles are "BAZ-V
use hash2curve::DomainSeparationTag; let dst = DomainSeparationTag::new(b"MySuperAwesomeProtocol", None, None, None); assert!(dst.is_ok()); let dst = DomainSeparationTag::new(b"", None, None, None); assert!(dst.is_err());
Methods
impl DomainSeparationTag
[src]
pub fn new(
protocol_id: &[u8],
protocol_version: Option<&[u8]>,
ciphersuite_id: Option<&[u8]>,
encoding_id: Option<&[u8]>
) -> Result<Self, HashingError>
[src]
protocol_id: &[u8],
protocol_version: Option<&[u8]>,
ciphersuite_id: Option<&[u8]>,
encoding_id: Option<&[u8]>
) -> Result<Self, HashingError>
Convenience function for creating a domain separation tag
pub fn to_bytes(&self) -> Vec<u8>
[src]
Convert the tag to bytes. All fields cannot be longer than 255 bytes in length
If a domain separation tag longer than 255 bytes must be used (e.g., because of requirements
imposed by an invoking protocol), this computes the
H("H2C-OVERSIZE-DST-" || protocol_id || procotol_version || ciphersuite_id || encoding_id)
D
must be a cryptographically secure hash function like SHA256, SHA3-256, or BLAKE2.
Trait Implementations
impl Clone for DomainSeparationTag
[src]
fn clone(&self) -> DomainSeparationTag
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DomainSeparationTag
[src]
impl Eq for DomainSeparationTag
[src]
impl From<DomainSeparationTag> for Bls12381G1Sswu
[src]
fn from(dst: DomainSeparationTag) -> Self
[src]
impl PartialEq<DomainSeparationTag> for DomainSeparationTag
[src]
fn eq(&self, other: &DomainSeparationTag) -> bool
[src]
fn ne(&self, other: &DomainSeparationTag) -> bool
[src]
impl StructuralEq for DomainSeparationTag
[src]
impl StructuralPartialEq for DomainSeparationTag
[src]
Auto Trait Implementations
impl RefUnwindSafe for DomainSeparationTag
impl Send for DomainSeparationTag
impl Sync for DomainSeparationTag
impl Unpin for DomainSeparationTag
impl UnwindSafe for DomainSeparationTag
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,