0
0
Cybersecurityknowledge~5 mins

Symmetric encryption (AES, DES) in Cybersecurity - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Symmetric encryption (AES, DES)
O(n)
Understanding Time 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.

Scenario Under Consideration

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 Repeating Operations

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.
How Execution Grows With Input

As the message gets longer, the number of blocks increases, so the encryption work grows in direct proportion.

Input Size (n blocks)Approx. Operations
1010 encryptions
100100 encryptions
10001000 encryptions

Pattern observation: Doubling the message size roughly doubles the work needed.

Final Time Complexity

Time Complexity: O(n)

This means the time to encrypt grows linearly with the size of the message.

Common Mistake

[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.

Interview Connect

Understanding how encryption time grows helps you explain performance in real systems and shows you can think about efficiency clearly.

Self-Check

"What if the encryption algorithm processed multiple blocks at once? How would that affect the time complexity?"