Struct lhash::HmacKey[][src]

pub struct HmacKey<D: Digest> { /* fields omitted */ }

Represents key used to sign content in hmac algorithm.

Comparing to hmac function it allows to pre-compute key and just sign input directly.

Digest is only used in methods, making user to be responsible for using correct algorithm.

Implementations

impl<D: Digest> HmacKey<D>[src]

pub fn new(secret: &[u8]) -> Self[src]

Creates new hmac key, using provided secret.

If secret size is above that of Digest::BlockType then algorithm it is hashed, reducing potential quality of hmac properties.

pub fn sign(&self, input: &[u8]) -> D::OutputType[src]

Signs provided input with the key.

Auto Trait Implementations

impl<D> Send for HmacKey<D> where
    <D as Digest>::BlockType: Send

impl<D> Sync for HmacKey<D> where
    <D as Digest>::BlockType: Sync

impl<D> Unpin for HmacKey<D> where
    <D as Digest>::BlockType: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.