Cleaned: BLOCKCIPHEREXAMPLEXX
Blocks: 5 (Block size: 4)
| A-E | F-J | K-O |
|---|---|---|
| A→F | J→O | S→X |
| B→G | K→P | T→Y |
| C→H | L→Q | U→Z |
| D→I | M→R | V→A |
| E→J | N→S | W→B |
| P-T | U-Y | Z |
F→K G→L H→M I→N J→O K→P L→Q M→R N→S | O→T P→U Q→V R→W S→X T→Y U→Z V→A W→B | X→C Y→D Z→E |
The permutation pattern [3,0,1,2] defines how characters are rearranged:
| Output Position | Takes from Input Position | Mapping |
|---|---|---|
| 0 | 3 | Output[0] = Input[3] |
| 1 | 0 | Output[1] = Input[0] |
| 2 | 1 | Output[2] = Input[1] |
| 3 | 2 | Output[3] = Input[2] |
Decryption: Uses inverse pattern [1,2,3,0]
Understanding how each position moves in the permutation pattern [3,0,1,2]:
Complete Pattern Transformation: [3,0,1,2]
Why Pattern [3,0,1,2]?
- Non-Identity: Actually changes the position (unlike [0,1,2,3])
- Maximum Diffusion: Every position moves to a different location
- Reversible: Can be inverted to [1,2,3,0] for decryption
- Educational: Shows diffusion/mixing principle in block ciphers like DES
Total Blocks
5
Block Size
4 characters
Block Division
The plaintext is divided into fixed-size blocks of 4 characters. If the last block is shorter, it is padded with 'X' characters to ensure all blocks are of equal size.
Encryption Process
Step 1 - Substitution: Each character in the block is replaced using an S-box (substitution box) derived from the key. The S-box performs a shift-based substitution.
Step 2 - Permutation: The positions of characters are rearranged using a fixed permutation pattern [3,0,1,2], which means: position 0 gets character from position 3, position 1 from position 0, etc.
Decryption Process
Decryption reverses the encryption: Inverse Permutation → Inverse Substitution
Key
The key (1-25) controls the S-box generation. Different keys produce different substitution and permutation results, making the encryption secure.