INNER CODE UNIT · Rust
new_pickle
matrix-org/vodozemac · src/cipher/mod.rs:150
pub fn new_pickle(key: &[u8]) -> Self {
let keys = CipherKeys::new_pickle(key);
Self { keys }
}
fn get_hmac(&self) -> HmacSha256 {
// We don't use HmacSha256::new() here because it expects a 64-byte
// large HMAC key while the Olm spec defines a 32-byte one instead.
//
// https://gitlab.matrix.org/matrix-org/olm/-/blob/master/docs/olm.md#version-1
#[allow(clippy::expect_used)]
HmacSha256::new_from_slice(self.keys.mac_key())
.expect("We should be able to create a HmacSha256 from a 32 byte key")
}
/// Encrypts the given plaintext using this [`Cipher`] and returns the
/// ciphertext.