pub fn signature(key: &[u8], data: &[u8]) -> Result<Vec<u8>, ErrorStack> {
    // Build the key, and signer
    let pkey = PKey::hmac(&key)?;
    let mut signer = Signer::new(MessageDigest::sha256(), &pkey)?;

    // Feed the data
    signer.update(&data)?;

    // Compute the signature
    Ok(signer.sign_to_vec()?)
}
/// Compute the signature for the given data and key.
/// This is done using an HMAC key using the SHA256 digest.
///
/// If computing the signature failed, an error is returned.
Compute the signature for the given data and key.
This is done using an HMAC key using the SHA256 digest.

If computing the signature failed, an error is returned.
Compute the signature for the given data and key . This is done using an HMAC key using the SHA256 digest . If computing the signature failed an error is returned .
pub fn signature(key: &[u8], data: &[u8]) -> Result<Vec<u8>, ErrorStack> {
    // Build the key, and signer
    let pkey = PKey::hmac(&key)?;
    let mut signer = Signer::new(MessageDigest::sha256(), &pkey)?;
    // Feed the data
    signer.update(&data)?;
    // Compute the signature
    Ok(signer.sign_to_vec()?)
}
pub fn signature ( key : & [ u8 ] , data : & [ u8 ] ) -> Result < Vec < u8 > , ErrorStack > { // Build the key, and signer let pkey = PKey :: hmac ( & key ) ? ; let mut signer = Signer :: new ( MessageDigest :: sha256 ( ) , & pkey ) ? ; // Feed the data signer . update ( & data ) ? ; // Compute the signature Ok ( signer . sign_to_vec ( ) ? ) }
Compute the signature for the given data and key.
Compute the signature for the given data and key .
key
&[u8]
data
&[u8]
key
&[u8]
data
&[u8]