Encryption

Computer Science · Data transmission. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science topics

The idea

Data sent over a network can be intercepted. Encryption does not stop this. It scrambles the data so that anyone who intercepts it cannot understand it.

The original readable data is called plaintext. An encryption algorithm and a key turn it into ciphertext. Only someone with the correct key can turn the ciphertext back into plaintext.

In symmetric encryption the same key is used to encrypt and decrypt, so the key must be shared, and it could be intercepted on the way. Asymmetric encryption solves this by using two different keys that work as a pair.

Rules to remember

Common mistake

Students say the sender encrypts with their own public key. The sender uses the receiver's public key, and the receiver decrypts with the receiver's own private key.

Worked example

Sara types her card number into an online shop that uses asymmetric encryption. Which keys are used, and by whom?

  1. The shop's public key is sent to Sara's browser. This is safe because a public key can be seen by anyone.
  2. Sara's browser encrypts the card number with the shop's public key, giving ciphertext.
  3. Only the shop's private key matches that public key, and the shop never shares it.
  4. A hacker who intercepts the ciphertext has no private key, so cannot read it.

Answer: Sara's browser encrypts with the shop's public key; the shop decrypts with its own private key.

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Methods of error detectionComputer architecture →Take a Computer Science test