diff --git a/aes/src/aes.rs b/aes/src/aes.rs index 8fd2ff3..9f447fc 100644 --- a/aes/src/aes.rs +++ b/aes/src/aes.rs @@ -18,8 +18,8 @@ impl BlockCipher for Aes { fn transform_impl( &self, - block: &[u8], - action: cipher_core::CipherAction, + _block: &[u8], + _action: cipher_core::CipherAction, ) -> cipher_core::CipherResult { todo!() } diff --git a/aes/src/key/subkeys.rs b/aes/src/key/subkeys.rs index a28d10c..0385776 100644 --- a/aes/src/key/subkeys.rs +++ b/aes/src/key/subkeys.rs @@ -28,7 +28,7 @@ impl Subkeys { for (round, &rcon) in RCON.iter().enumerate() { let idx = round * 4 + 4; - subkeys[idx + 0] = subkeys[idx - 4] ^ expand(&subkeys[idx - 1], rcon); + subkeys[idx] = subkeys[idx - 4] ^ expand(subkeys[idx - 1], rcon); subkeys[idx + 1] = subkeys[idx] ^ subkeys[idx - 3]; subkeys[idx + 2] = subkeys[idx + 1] ^ subkeys[idx - 2]; subkeys[idx + 3] = subkeys[idx + 2] ^ subkeys[idx - 1]; @@ -82,7 +82,7 @@ impl Debug for Subkeys { } } -const fn expand(subkey: &Subkey, rcon: u32) -> ExpandedKey { +const fn expand(subkey: Subkey, rcon: u32) -> ExpandedKey { let word = subkey.rotate_left(8).as_u32(); let b0 = sbox_lookup(word >> 24); @@ -105,7 +105,7 @@ const fn sbox_lookup(byte: u32) -> u32 { mod tests { use super::*; - const TEST_KEY: u128 = 0x0F1571C947D9E8591CB7ADD6AF7F6798; + const TEST_KEY: u128 = 0x0F15_71C9_47D9_E859_1CB7_ADD6_AF7F_6798; impl PartialEq<[[u8; 4]; 44]> for Subkeys { fn eq(&self, other: &[[u8; 4]; 44]) -> bool { @@ -167,6 +167,6 @@ mod tests { [0xDD, 0xB0, 0x06, 0x46], [0x86, 0xDB, 0x18, 0x10], ] - ) + ); } } diff --git a/aes/src/utils.rs b/aes/src/utils.rs index ae51a13..b23c23b 100644 --- a/aes/src/utils.rs +++ b/aes/src/utils.rs @@ -10,7 +10,7 @@ /// The table should have `output_bits` entries. For each entry i (0-based), `position_table`[i] indicates /// which input bit (1-based) should go to the i-th output bit position (from MSB to LSB). #[must_use] -pub fn permutate( +pub fn _permutate( input: u64, input_bit_amount: u64, output_bit_amount: u64, diff --git a/des/src/utils.rs b/des/src/utils.rs index ae51a13..ab60209 100644 --- a/des/src/utils.rs +++ b/des/src/utils.rs @@ -1,4 +1,5 @@ /// Generic bit permutation for DES specification. +/// /// DES uses 1-based positioning where bit 1 is the leftmost (MSB) and bit 64 is the rightmost (LSB). /// This function handles this correctly for arbitrary input/output sizes. ///