Skip to main content

DomainSeparation

Enum DomainSeparation 

Source
pub enum DomainSeparation<'a> {
    None,
    Context(&'a [u8]),
    Prehashed {
        alg: PreHashAlgorithm,
        context: &'a [u8],
    },
}
Expand description

Domain separation context for FN-DSA / HashFN-DSA (FIPS 206 §6).

§Variants

  • None — Pure FN-DSA, no context string (ph_flag = 0x00, context length = 0).

  • Context — Pure FN-DSA with an application context string (1–255 bytes, ph_flag = 0x00).

  • Prehashed — HashFN-DSA mode (ph_flag = 0x01). The message is pre-hashed; the algorithm OID and optional context string are injected into the hash context.

§FIPS 206 Wire Format

For all variants the bytes injected into the hash context (after the 40-byte nonce) are:

  • Pure: ph_flag(0x00) || len(ctx) || ctx
  • Hashed: ph_flag(0x01) || len(ctx) || ctx || OID || hash(msg)

The context string must not exceed 255 bytes; passing a longer slice returns Err(FalconError::BadArgument).

Variants§

§

None

No context string (pure FN-DSA, empty context).

§

Context(&'a [u8])

Application context string — max 255 bytes, pure FN-DSA.

§

Prehashed

HashFN-DSA mode: pre-hash the message with alg, optionally bind with context (max 255 bytes).

Fields

§alg: PreHashAlgorithm

Pre-hash algorithm.

§context: &'a [u8]

Optional context string (max 255 bytes).

Trait Implementations§

Source§

impl<'a> Clone for DomainSeparation<'a>

Source§

fn clone(&self) -> DomainSeparation<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for DomainSeparation<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for DomainSeparation<'a>

Source§

fn eq(&self, other: &DomainSeparation<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Copy for DomainSeparation<'a>

Source§

impl<'a> Eq for DomainSeparation<'a>

Source§

impl<'a> StructuralPartialEq for DomainSeparation<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DomainSeparation<'a>

§

impl<'a> RefUnwindSafe for DomainSeparation<'a>

§

impl<'a> Send for DomainSeparation<'a>

§

impl<'a> Sync for DomainSeparation<'a>

§

impl<'a> Unpin for DomainSeparation<'a>

§

impl<'a> UnsafeUnpin for DomainSeparation<'a>

§

impl<'a> UnwindSafe for DomainSeparation<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.