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:

  1. Input a 128-bit key as a 32-character hex string
  2. Convert the key from hex to bytes
  3. Convert the plaintext to bytes
  4. Pad the plaintext to a multiple of 16 bytes using PKCS7 padding
  5. For each 16-byte block of plaintext:
    1. Perform key expansion
    2. Add round key (initial round)
    3. Perform 9 main rounds:
      • Substitute bytes
      • Shift rows
      • Mix columns
      • Add round key
    4. Perform final round:
      • Substitute bytes
      • Shift rows
      • Add round key
  6. Concatenate all encrypted blocks
  7. Convert the result to base64 for display

Decryption Steps:

  1. Convert the base64 ciphertext to bytes
  2. Convert the key from hex to bytes
  3. For each 16-byte block of ciphertext:
    1. Perform key expansion
    2. Add round key (final round key)
    3. Perform 9 main rounds:
      • Inverse shift rows
      • Inverse substitute bytes
      • Add round key
      • Inverse mix columns
    4. Perform final round:
      • Inverse shift rows
      • Inverse substitute bytes
      • Add round key (initial round key)
  4. Concatenate all decrypted blocks
  5. Remove PKCS7 padding
  6. Convert the result to text for display