Skip to main content

KeyInit

Trait KeyInit 

pub trait KeyInit: Sized + KeySizeUser {
    // Required method
    fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;

    // Provided method
    fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength> { ... }
}
Expand description

Types which can be initialized from key.

Required Methods§

fn new(key: &GenericArray<u8, Self::KeySize>) -> Self

Create new value from fixed size key.

Provided Methods§

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable size key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<D> KeyInit for HmacCore<D>

Source§

impl<D> KeyInit for SimpleHmac<D>
where D: Digest + BlockSizeUser,

§

impl<OutSize> KeyInit for Blake2bMac<OutSize>
where OutSize: ArrayLength<u8> + IsLessOrEqual<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>, <OutSize as IsLessOrEqual<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>::Output: NonZero,

§

fn new( key: &GenericArray<u8, <Blake2bMac<OutSize> as KeySizeUser>::KeySize>, ) -> Blake2bMac<OutSize>

§

fn new_from_slice(key: &[u8]) -> Result<Blake2bMac<OutSize>, InvalidLength>

§

impl<OutSize> KeyInit for Blake2sMac<OutSize>
where OutSize: ArrayLength<u8> + IsLessOrEqual<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>, <OutSize as IsLessOrEqual<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>::Output: NonZero,

§

fn new( key: &GenericArray<u8, <Blake2sMac<OutSize> as KeySizeUser>::KeySize>, ) -> Blake2sMac<OutSize>

§

fn new_from_slice(key: &[u8]) -> Result<Blake2sMac<OutSize>, InvalidLength>

Implementors§