fn calculate_siv(&self, aad: &[u8], plaintext: &[u8]) -> SIV {
		let mut hmac = Hmac::new(Sha512::new(), &self.siv_key[..]);
		hmac.input(aad);
		hmac.input(plaintext);
		hmac.input(&u64::try_from(aad.len()).expect("calculate_siv: length did not fit into u64").to_le_bytes());
		hmac.input(&u64::try_from(plaintext.len()).expect("calculate_siv: length did not fit into u64").to_le_bytes());

		// Truncated to 256-bits
		SIV::from_slice(&hmac.result().code()[..32]).expect("internal error")
	}
// TODO: This method should be private
/// Calculate the unique SIV for the combination of self.siv_key, aad, and plaintext.
/// Equivilent to: HMAC-SHA-512-256 (siv_key, aad || plaintext || le64(aad.length) || le64(plaintext.length))
This method should be private
Calculate the unique SIV for the combination of self.siv_key, aad, and plaintext.
This method should be private Calculate the unique SIV for the combination of self . siv_key aad and plaintext .
fn calculate_siv(&self, aad: &[u8], plaintext: &[u8]) -> SIV {
		let mut hmac = Hmac::new(Sha512::new(), &self.siv_key[..]);
		hmac.input(aad);
		hmac.input(plaintext);
		hmac.input(&u64::try_from(aad.len()).expect("calculate_siv: length did not fit into u64").to_le_bytes());
		hmac.input(&u64::try_from(plaintext.len()).expect("calculate_siv: length did not fit into u64").to_le_bytes());
		// Truncated to 256-bits
		SIV::from_slice(&hmac.result().code()[..32]).expect("internal error")
	}
fn calculate_siv ( & self , aad : & [ u8 ] , plaintext : & [ u8 ] ) -> SIV { let mut hmac = Hmac :: new ( Sha512 :: new ( ) , & self . siv_key [ .. ] ) ; hmac . input ( aad ) ; hmac . input ( plaintext ) ; hmac . input ( & u64 :: try_from ( aad . len ( ) ) . expect ( " " ) . to_le_bytes ( ) ) ; hmac . input ( & u64 :: try_from ( plaintext . len ( ) ) . expect ( " " ) . to_le_bytes ( ) ) ; // Truncated to 256-bits SIV :: from_slice ( & hmac . result ( ) . code ( ) [ .. 32 ] ) . expect ( " " ) }
TODO: This method should be private
Calculate the unique SIV for the combination of self.siv_key, aad, and plaintext.
TODO : This method should be private Calculate the unique SIV for the combination of self . siv_key aad and plaintext .
&self
aad
&[u8]
plaintext
&[u8]
&self
aad
&[u8]
plaintext
&[u8]