1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const E_BOX: = ;
/// DES Expansion Permutation (E-box)
///
/// Expands a 32-bit input into a 48-bit output using the DES expansion
/// permutation table.
///
/// This function is used inside the DES F-function to:
///
/// - Expand 32-bit right half
/// - Duplicate boundary bits
/// - Prepare for XOR with round key
///
/// # Overview
///
/// The expansion follows the DES E-box permutation:
///
/// - Input: 32 bits
/// - Output: 48 bits
/// - Some bits are duplicated
///
/// # Arguments
///
/// * `bits` - 32-bit right half block
///
/// # Returns
///
/// A 48-bit expanded value stored in `u64`
///
/// # Examples
///
/// ```rust
/// use cryptograph::cryptography::des::e_box::e_box;
///
/// let input: u32 = 0x12345678;
/// let expanded = e_box(input);
///
/// assert!(expanded <= 0xFFFFFFFFFFFF);
/// ```
///
/// # Notes
///
/// - Output uses only lower 48 bits
/// - Used before XOR with round key
/// - Part of DES F-function
///
/// # See also
///
/// - `f()`
/// - `SBOXES`
/// - `permutation`