Skip to main content

Nonce

Struct Nonce 

Source
pub struct Nonce(/* private fields */);
Expand description

Nonce bytes carried by signed invocations and WHY queries.

Nonce intentionally does not implement Clone or Copy; duplicating nonce bytes increases the number of plaintext copies that must be cleared.

Implementations§

Source§

impl Nonce

Source

pub const LEN: usize = 16

Nonce byte length for the first BCX profile.

Source

pub fn new(bytes: [u8; 16]) -> Result<Self, ValidationError>

Creates a nonce from non-zero raw bytes.

Source

pub const fn as_bytes(&self) -> &[u8; 16]

Returns the nonce as bytes.

Source

pub fn ct_eq(&self, other: &Self) -> bool

Compares two nonces without data-dependent early exit.

Trait Implementations§

Source§

impl Debug for Nonce

Source§

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

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

impl Drop for Nonce

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for Nonce

Source§

impl Hash for Nonce

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Hashes nonce bytes for non-adversarial collection use.

This hash operation is not constant-time. Replay caches for high-assurance deployments should use a keyed structure that accounts for timing and bucket-collision behavior instead of treating Hash as a security boundary.

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Nonce

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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.

Auto Trait Implementations§

§

impl Freeze for Nonce

§

impl RefUnwindSafe for Nonce

§

impl Send for Nonce

§

impl Sync for Nonce

§

impl Unpin for Nonce

§

impl UnsafeUnpin for Nonce

§

impl UnwindSafe for Nonce

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> 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, 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.