Symmetric encryption (AES, DES) in Cybersecurity - Time & Space Complexity
When using symmetric encryption like AES or DES, it is important to understand how the time to encrypt or decrypt data changes as the amount of data grows.
We want to know how the work needed increases when the message size gets bigger.
Analyze the time complexity of the following simplified encryption process.
for each block in message:
encrypted_block = encrypt_block(block, key)
output.append(encrypted_block)
This code splits the message into blocks and encrypts each block one by one using a fixed key.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Encrypting each block of data.
- How many times: Once for every block in the message.
As the message gets longer, the number of blocks increases, so the encryption work grows in direct proportion.
| Input Size (n blocks) | Approx. Operations |
|---|---|
| 10 | 10 encryptions |
| 100 | 100 encryptions |
| 1000 | 1000 encryptions |
Pattern observation: Doubling the message size roughly doubles the work needed.
Time Complexity: O(n)
This means the time to encrypt grows linearly with the size of the message.
[X] Wrong: "Encrypting a message takes the same time no matter how big it is."
[OK] Correct: Each block must be processed separately, so bigger messages take more time.
Understanding how encryption time grows helps you explain performance in real systems and shows you can think about efficiency clearly.
"What if the encryption algorithm processed multiple blocks at once? How would that affect the time complexity?"