pub fn generate_round_keys(key: u64) -> [u64; 16] {
    let mut keys: [u64; 16] = [0; 16];

    // We do not split the key, but keep both C and D as one u64.
    let mut cd: u64 = permute(key, 64, &data::PC1);

    // Mask to get the two leftmost bits which will be shifted around.
    let data_mask = (1 << 55) | (1 << 27);
    // Mask to reset bits which should be zero after regular shifting.
    let zero_mask = (0xFF << 56) | (1 << 28);

    for (i, &num_shifts) in data::LSHIFTS.iter().enumerate() {
        // Just run multiple shifts as a sequence of single shifts.
        for _ in 0..num_shifts {
            let data: u64 = (cd & data_mask) >> 27;
            cd = (cd << 1) & !zero_mask | data;
        }
        keys[i] = permute(cd, 56, &data::PC2);
    }

    return keys;
}
/// Generate all 16 round keys from the original key.
Generate all 16 round keys from the original key.
Generate all 16 round keys from the original key .
pub fn generate_round_keys(key: u64) -> [u64; 16] {
    let mut keys: [u64; 16] = [0; 16];
    // We do not split the key, but keep both C and D as one u64.
    let mut cd: u64 = permute(key, 64, &data::PC1);
    // Mask to get the two leftmost bits which will be shifted around.
    let data_mask = (1 << 55) | (1 << 27);
    // Mask to reset bits which should be zero after regular shifting.
    let zero_mask = (0xFF << 56) | (1 << 28);
    for (i, &num_shifts) in data::LSHIFTS.iter().enumerate() {
        // Just run multiple shifts as a sequence of single shifts.
        for _ in 0..num_shifts {
            let data: u64 = (cd & data_mask) >> 27;
            cd = (cd << 1) & !zero_mask | data;
        }
        keys[i] = permute(cd, 56, &data::PC2);
    }
    return keys;
}
pub fn generate_round_keys ( key : u64 ) -> [ u64 ; 16 ] { let mut keys : [ u64 ; 16 ] = [ 0 ; 16 ] ; // We do not split the key, but keep both C and D as one u64. let mut cd : u64 = permute ( key , 64 , & data :: PC1 ) ; // Mask to get the two leftmost bits which will be shifted around. let data_mask = ( 1 << 55 ) | ( 1 << 27 ) ; // Mask to reset bits which should be zero after regular shifting. let zero_mask = ( 0xFF << 56 ) | ( 1 << 28 ) ; for ( i , & num_shifts ) in data :: LSHIFTS . iter ( ) . enumerate ( ) { // Just run multiple shifts as a sequence of single shifts. for _ in 0 .. num_shifts { let data : u64 = ( cd & data_mask ) >> 27 ; cd = ( cd << 1 ) & ! zero_mask | data ; } keys [ i ] = permute ( cd , 56 , & data :: PC2 ) ; } return keys ; }
Generate all 16 round keys from the original key.
Generate all 16 round keys from the original key .
key
u64
key
u64