Cryptography Assignment
1. Classical Symmetric Ciphers
Playfair Cipher
Encryption Time:
0.000 ms
Decryption Time:
0.000 ms
Playfair Matrix:
Encryption Steps:
Decryption Steps:
Rail Fence Cipher
Encryption Time:
0.000 ms
Decryption Time:
0.000 ms
Encryption Steps:
Decryption Steps:
Playfair and Rail Fence Product
Encryption Time:
0.000 ms
Decryption Time:
0.000 ms
Playfair Matrix:
Encryption Steps (Playfair):
Encryption Steps (RailFence):
Decryption Steps: (RailFence)
Decryption Steps: (PlayFair)
2. Hybrid Modern Asymmetric and Symmetric Cipher
Key Generation Steps
Encryption Steps
Decryption Steps
Encryption Time:
0 ms
Decryption Time:
0 ms
AES Encryption
AES-ECB Encryption (128-bit key)
Encryption Time:
0 ms
Decryption Time:
0 ms
Encryption Steps:
Decryption Steps:
- Input a 128-bit key as a 32-character hex string
- Convert the key from hex to bytes
- Convert the plaintext to bytes
- Pad the plaintext to a multiple of 16 bytes using PKCS7 padding
- For each 16-byte block of plaintext:
- Perform key expansion
- Add round key (initial round)
- Perform 9 main rounds:
- Substitute bytes
- Shift rows
- Mix columns
- Add round key
- Perform final round:
- Substitute bytes
- Shift rows
- Add round key
- Concatenate all encrypted blocks
- Convert the result to base64 for display
Decryption Steps:
- Convert the base64 ciphertext to bytes
- Convert the key from hex to bytes
- For each 16-byte block of ciphertext:
- Perform key expansion
- Add round key (final round key)
- Perform 9 main rounds:
- Inverse shift rows
- Inverse substitute bytes
- Add round key
- Inverse mix columns
- Perform final round:
- Inverse shift rows
- Inverse substitute bytes
- Add round key (initial round key)
- Concatenate all decrypted blocks
- Remove PKCS7 padding
- Convert the result to text for display