fn encrypt_and_mix_hash<B: AsRef<[u8]>>(&mut self, plaintext: B) -> OckamResult<Vec<u8>> {
        let h = &self.h.ok_or_else(|| Error::InvalidState.into())?;

        let mut nonce = [0u8; 12];
        nonce[10..].copy_from_slice(&self.nonce.to_be_bytes());
        let ciphertext_and_tag = {
            let mut vault = self.vault.lock().unwrap();
            let key = self.key.as_ref().ok_or(Error::InvalidState.into())?;
            vault.aead_aes_gcm_encrypt(key, plaintext.as_ref(), nonce.as_ref(), h)?
        };
        self.mix_hash(&ciphertext_and_tag)?;
        self.nonce += 1;
        Ok(ciphertext_and_tag)
    }
/// Encrypt and mix step in Noise protocol
Encrypt and mix step in Noise protocol
Encrypt and mix step in Noise protocol
fn encrypt_and_mix_hash<B: AsRef<[u8]>>(&mut self, plaintext: B) -> OckamResult<Vec<u8>> {
        let h = &self.h.ok_or_else(|| Error::InvalidState.into())?;
        let mut nonce = [0u8; 12];
        nonce[10..].copy_from_slice(&self.nonce.to_be_bytes());
        let ciphertext_and_tag = {
            let mut vault = self.vault.lock().unwrap();
            let key = self.key.as_ref().ok_or(Error::InvalidState.into())?;
            vault.aead_aes_gcm_encrypt(key, plaintext.as_ref(), nonce.as_ref(), h)?
        };
        self.mix_hash(&ciphertext_and_tag)?;
        self.nonce += 1;
        Ok(ciphertext_and_tag)
    }
fn encrypt_and_mix_hash < B : AsRef < [ u8 ] > > ( & mut self , plaintext : B ) -> OckamResult < Vec < u8 > > { let h = & self . h . ok_or_else ( | | Error :: InvalidState . into ( ) ) ? ; let mut nonce = [ 0u8 ; 12 ] ; nonce [ 10 .. ] . copy_from_slice ( & self . nonce . to_be_bytes ( ) ) ; let ciphertext_and_tag = { let mut vault = self . vault . lock ( ) . unwrap ( ) ; let key = self . key . as_ref ( ) . ok_or ( Error :: InvalidState . into ( ) ) ? ; vault . aead_aes_gcm_encrypt ( key , plaintext . as_ref ( ) , nonce . as_ref ( ) , h ) ? } ; self . mix_hash ( & ciphertext_and_tag ) ? ; self . nonce += 1 ; Ok ( ciphertext_and_tag ) }
Encrypt and mix step in Noise protocol
Encrypt and mix step in Noise protocol
&mut self
plaintext
B
&mut self
plaintext
B