chore(aes): remove unused function

This commit is contained in:
Kristofers Solo 2025-12-30 23:48:38 +02:00
parent c3f39cedc9
commit 656e112d9f
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
2 changed files with 0 additions and 29 deletions

View File

@ -4,6 +4,5 @@ mod constants;
mod key;
mod operations;
mod sbox;
mod utils;
pub use {aes::Aes, block::Block128};

View File

@ -1,28 +0,0 @@
/// 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.
///
/// # Arguments
/// - `input` - The input value (treated as a bitfield of `input_bits` size)
/// - `input_bits` - Number of meaningful bits in the input (1-64)
/// - `output_bits` - Number of bits in the output (1-64)
/// - `position_table` - Table of 1-based positions (1 to `input_bits`) where each output bit comes from.
/// 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(
input: u64,
input_bit_amount: u64,
output_bit_amount: u64,
position_table: &[u8],
) -> u64 {
position_table
.iter()
.enumerate()
.fold(0, |acc, (idx, &input_pos_1based)| {
let input_bit_pos = input_bit_amount - u64::from(input_pos_1based);
let bit_value = (input >> input_bit_pos) & 1;
let output_bit_pos = output_bit_amount - 1 - (idx as u64);
acc | (bit_value << output_bit_pos)
})
}