pub fn decrypt_length_header(&mut self, msg: &[u8]) -> Result<u16, HandleError> {
		assert_eq!(msg.len(), 16 + 2);

		match self.noise_state {
			Finished {
				sk: _,
				sn: _,
				sck: _,
				ref mut rk,
				ref mut rn,
				ref mut rck,
			} => {
				if *rn >= 1000 {
					let (new_rck, new_rk) = Self::hkdf_extract_expand(rck, rk);
					*rck = new_rck;
					*rk = new_rk;
					*rn = 0;
				}

				let mut res = [0; 2];
				Self::decrypt_with_ad(&mut res, *rn, rk, &[0; 0], msg)?;
				*rn += 1;
				Ok(byte_utils::slice_to_be16(&res))
			}
		}
	}
/// Decrypts a message length header from the remote peer.
/// panics if noise handshake has not yet finished or msg.len() != 18
Decrypts a message length header from the remote peer.
panics if noise handshake has not yet finished or msg.len() != 18
Decrypts a message length header from the remote peer . panics if noise handshake has not yet finished or msg . len () ! = 18
pub fn decrypt_length_header(&mut self, msg: &[u8]) -> Result<u16, HandleError> {
		assert_eq!(msg.len(), 16 + 2);
		match self.noise_state {
			Finished {
				sk: _,
				sn: _,
				sck: _,
				ref mut rk,
				ref mut rn,
				ref mut rck,
			} => {
				if *rn >= 1000 {
					let (new_rck, new_rk) = Self::hkdf_extract_expand(rck, rk);
					*rck = new_rck;
					*rk = new_rk;
					*rn = 0;
				}
				let mut res = [0; 2];
				Self::decrypt_with_ad(&mut res, *rn, rk, &[0; 0], msg)?;
				*rn += 1;
				Ok(byte_utils::slice_to_be16(&res))
			}
		}
	}
pub fn decrypt_length_header ( & mut self , msg : & [ u8 ] ) -> Result < u16 , HandleError > { assert_eq ! ( msg len ( ) 16 2 ) ; match self . noise_state { Finished { sk : _ , sn : _ , sck : _ , ref mut rk , ref mut rn , ref mut rck , } => { if * rn >= 1000 { let ( new_rck , new_rk ) = Self :: hkdf_extract_expand ( rck , rk ) ; * rck = new_rck ; * rk = new_rk ; * rn = 0 ; } let mut res = [ 0 ; 2 ] ; Self :: decrypt_with_ad ( & mut res , * rn , rk , & [ 0 ; 0 ] , msg ) ? ; * rn += 1 ; Ok ( byte_utils :: slice_to_be16 ( & res ) ) } } }
Decrypts a message length header from the remote peer.
Decrypts a message length header from the remote peer .
&mut self
msg
&[u8]