Trait tink_core::Mac[][src]

pub trait Mac: MacBoxClone {
    fn compute_mac(&self, data: &[u8]) -> Result<Vec<u8>, TinkError>;

    fn verify_mac(&self, mac: &[u8], data: &[u8]) -> Result<(), TinkError> { ... }
}

Mac is the interface for MACs (Message Authentication Codes). This interface should be used for authentication only, and not for other purposes (for example, it should not be used to generate pseudorandom bytes).

Required methods

fn compute_mac(&self, data: &[u8]) -> Result<Vec<u8>, TinkError>[src]

Compute message authentication code (MAC) for code data.

Loading content...

Provided methods

fn verify_mac(&self, mac: &[u8], data: &[u8]) -> Result<(), TinkError>[src]

Returns () if mac is a correct authentication code (MAC) for data, otherwise it returns an error.

Loading content...

Implementors

Loading content...