Skip to main content

ThreefishParamsOwned

Struct ThreefishParamsOwned 

Source
pub struct ThreefishParamsOwned { /* private fields */ }
Expand description

An owned key with an optional owned tweak, both wiped on drop.

Available with the alloc feature. Construction takes the vectors without copying them. Nothing is validated here; the engine checks both lengths in init. Wiping does not erase copies held elsewhere. Debug prints the lengths, never the key or tweak.

§Example

use tc_threefish::{ThreefishParams, ThreefishParamsOwned};

let params = ThreefishParamsOwned::with_tweak(vec![0x42; 32], vec![0x11; 16]);
assert_eq!(params.tweak(), Some(&[0x11; 16][..]));

Implementations§

Source§

impl ThreefishParamsOwned

Source

pub const fn new(key: Vec<u8>) -> Self

Uses key with Threefish’s all-zero tweak. Constant time: moves the vector without inspecting its bytes.

Source

pub const fn with_tweak(key: Vec<u8>, tweak: Vec<u8>) -> Self

Uses key with an explicit tweak. Constant time: moves the vectors without inspecting their bytes.

Trait Implementations§

Source§

impl Debug for ThreefishParamsOwned

Source§

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

Writes the key and tweak lengths, never their bytes. Constant time.

Source§

impl Drop for ThreefishParamsOwned

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 KeyParams for ThreefishParamsOwned

Source§

fn key(&self) -> &[u8] ⓘ

Returns the stored key without copying it. Constant time.

Source§

impl ThreefishParams for ThreefishParamsOwned

Source§

fn tweak(&self) -> Option<&[u8]>

Returns the stored tweak without copying it. Constant time.

Source§

impl Zeroize for ThreefishParamsOwned

Source§

fn zeroize(&mut self)

Overwrites the key and tweak with zeros, leaving the key empty and the tweak absent. Constant time.

Source§

impl ZeroizeOnDrop for ThreefishParamsOwned

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.