Skip to main content

sign_to_buffer

Function sign_to_buffer 

pub fn sign_to_buffer<'out>(
    key: &Key,
    data: &[u8],
    output: &'out mut [u8],
) -> Result<&'out mut [u8], Unspecified>
Expand description

Calculates the HMAC of data using the key key in one step, writing the result into the provided output buffer.

The output buffer must be at least as large as the algorithm’s tag length (i.e., key.algorithm().tag_len()). The returned slice will be a sub-slice of output containing exactly the tag bytes.

It is generally not safe to implement HMAC verification by comparing the return value of sign_to_buffer to a tag. Use verify for verification instead.

§Errors

error::Unspecified if output is too small or if the HMAC operation fails.