aes-project/src/main.rs

26 lines
668 B
Rust
Raw Normal View History

2024-04-26 18:47:30 +02:00
mod aes;
use aes::Aes;
2024-04-12 18:52:42 +02:00
fn main() {
2024-04-26 18:47:30 +02:00
let key: [u8; 16] = [
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f,
0x3c,
];
let expanded_key = Aes::key_schedule(&key);
for i in 0..11 {
println!("Block {}", i + 1);
for j in 0..4 {
let index = i * 4 + j;
print!(" ");
for &byte in &expanded_key[index] {
print!("{:02x}", byte);
}
println!();
}
}
let my_number: u32 = 0x2b7e1516;
let bytes: [u8; 4] = my_number.to_be_bytes();
for &byte in &bytes {
println!("{:02x}", byte);
}
2024-04-12 18:52:42 +02:00
}