diff --git a/README.md b/README.md index ad730b4..46f73a5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # aes-project +AES-128, and square attack against reduced AES-128 (only 4-turns) implementation in rust. +### example +encrypt the text "Hello, world!" using the key 2b7e151628aed2a6abf7158809cf4f3c, hex-encoded. 10-turns AES-128 + +``` +cargo run -- encrypt -K -k '2b7e151628aed2a6abf7158809cf4f3c' -t "Hello, world!" -n 10 +``` +square attack against 4-turns AES-128, choosen key bba51a66aca801747294ff4317fb59e2, hex-encoded. +``` +cargo run -- findkey bba51a66aca801747294ff4317fb59e2 -K +``` +square attack against 4-turns AES-128, 10 keys generated randomly. +``` +cargo run -- square 10 +``` diff --git a/src/aes.rs b/src/aes.rs index a114d44..878a591 100644 --- a/src/aes.rs +++ b/src/aes.rs @@ -324,7 +324,7 @@ impl Aes { original_key[i / 4][i % 4] = key_bytes[i]; } - // AES128, 11 rounds, i ∈ [0;4*rounds-1] + // AES128, 10 rounds + pre-whitening, i ∈ [0;4*rounds-1] for i in 0..44 { if i < n { expanded_key[i] = original_key[i];