From adfd55f99c2ca4353b14effa241ee46aa31d3160 Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Mon, 27 Apr 2026 13:37:53 +0200 Subject: [PATCH] cargo clippy --- src/tea3_from_c.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tea3_from_c.rs b/src/tea3_from_c.rs index 71b82bf..41cc4c0 100644 --- a/src/tea3_from_c.rs +++ b/src/tea3_from_c.rs @@ -48,8 +48,7 @@ impl Tea3FromC { let b_reord_byte4 = tea3_reorder_state_byte(((self.iv >> 32) & 0xff) as u8); // Step 3: Combine current state with state derived values and XOR in key derived SBOX output - let b_new_byte = - (((self.iv >> 56) as u8) ^ b_reord_byte4 ^ b_deriv_byte12 ^ b_sbox_out) & 0xff; + let b_new_byte = ((self.iv >> 56) as u8) ^ b_reord_byte4 ^ b_deriv_byte12 ^ b_sbox_out; let b_mix_byte = b_deriv_byte56 as u64; // Step 4: Update 64 bits state @@ -82,10 +81,10 @@ fn tea3_state_word_to_newbyte(w_st: u16, aw_lut: &[u16; 8]) -> u8 { let mut b_st1 = (w_st >> 8) as u8; let mut b_out = 0u8; - for i in 0..8 { + for (i, &lut_item) in aw_lut.iter().enumerate() { let b_dist = ((b_st0 >> 5) & 3) | ((b_st1 >> 3) & 12); - if (aw_lut[i] & (1 << b_dist)) != 0 { - b_out |= 1 << i; + if (lut_item & (1u16 << b_dist)) != 0 { + b_out |= 1u8 << i; } b_st0 = b_st0.rotate_right(1);