Encryption Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Encryption.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

Encryption is the process of transforming readable data into an unreadable form so only someone with the right key can recover the original message. It is used to protect stored files, passwords, and data moving across networks.

Encryption is like locking a message in a box. Anyone can see the box, but only someone with the key can open it.

Read the full concept explanation β†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Encryption protects confidentiality by making data unreadable without the correct key.

Common stuck point: Encryption protects data from reading, but it does not automatically prove the sender is trustworthy or the device is safe.

Sense of Study hint: When deciding whether encryption matters, ask whether the data is private, where it is stored, and whether it travels over a network that other people could inspect.

Worked Examples

Example 1

medium
Encrypt `CODE` with Caesar shift +7+7.

Answer

JVKL\text{JVKL}

First step

1
C(2)+7=9 \to J.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Unlock answer keys One Family plan β€” every worked solution, all subjects

Example 2

medium
In Diffie-Hellman, Alice and Bob each pick a secret. What do they exchange publicly?

Example 3

medium
You receive `KHOOR` and suspect Caesar with shift +3+3. Decrypt.

Example 4

hard
You intercept ciphertext encrypted with a Vigenère key of length 4. Frequency analysis works because ___.

Example 5

hard
In TLS, ephemeral Diffie-Hellman provides 'forward secrecy.' Explain.

Example 6

challenge
Quantum computers threaten RSA via Shor's algorithm but symmetric AES-256 is considered safer. Why?

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
Encryption transforms readable plaintext into unreadable ciphertext. What is needed to recover the original message?

Example 2

easy
Apply a Caesar cipher with shift +3 to the letter A. What letter results?

Example 3

easy
Decrypt the Caesar ciphertext 'KHOOR' using shift -3.

Example 4

easy
In symmetric encryption, how many keys are used to encrypt and decrypt?

Example 5

easy
In asymmetric (public-key) encryption, which key encrypts a message sent TO Alice?

Example 6

easy
True or false: encryption alone guarantees a message was not altered in transit.

Example 7

easy
Encrypt the letter Z with a Caesar shift of +1. (The alphabet wraps around.)

Example 8

easy
Why is encryption useful for everyday users, not just banks and governments?

Example 9

medium
Decrypt the Caesar ciphertext 'ZRUOG' that used shift +3. What is the plaintext?

Example 10

medium
Encrypt 'CAT' with a Caesar shift of +2.

Example 11

medium
Why does asymmetric encryption solve the key-distribution problem that symmetric encryption has?

Example 12

medium
HTTPS uses slow asymmetric encryption to exchange a key, then fast symmetric encryption for the data. Why combine them?

Example 13

medium
A Caesar cipher has only 25 useful shifts. Why is it trivially breakable, and what is the attack called?

Example 14

medium
Decrypt 'IFMMP' (Caesar shift +1) and state the plaintext.

Example 15

medium
A site encrypts stored passwords with a reversible key the server holds. Why do experts prefer hashing passwords instead?

Example 16

medium
Encrypt 'XYZ' with a Caesar shift of +3, using wrap-around.

Example 17

medium
Encrypt the letter 'Y' with a Caesar shift of +5, using wrap-around.

Example 18

challenge
You intercept Caesar ciphertext 'WKH' and suspect it is a common 3-letter English word. By trying shifts, recover the most likely plaintext and give the shift used.

Example 19

challenge
Explain why a 'one-time pad' (random key as long as the message, used once) is unbreakable, while reusing the same pad twice is catastrophic.

Example 20

challenge
Why is a Vigenere cipher (Caesar with a repeating multi-letter key) much harder to break than a single Caesar shift, yet still breakable?

Example 21

easy
Apply a Caesar cipher with shift +4+4 to the letter B. What letter results?

Example 22

easy
Decrypt the Caesar ciphertext `EBB` with shift βˆ’1-1.

Example 23

easy
Encrypt the letter M with a Caesar shift +5+5.

Example 24

easy
Apply Caesar shift +13+13 to the letter A.

Example 25

easy
Encrypt `DOG` with a Caesar shift +1+1.

Example 26

medium
Decrypt `MJQQT` (Caesar shift +5+5).

Example 27

medium
In HTTPS, what does the server's TLS certificate prove?

Example 28

medium
Encrypt `ZAP` with Caesar shift +2+2 (use wrap-around).

Example 29

medium
Decrypt `BOSSF` (Caesar shift +1+1).

Example 30

medium
For Alice to send Bob a private message via public-key crypto, which key does she use?

Example 31

medium
A 256-bit symmetric key has how many possible values?

Example 32

hard
Brute-forcing a 40-bit key at 10910^9 keys/sec takes about how long on average?

Example 33

hard
You XOR-encrypt the byte 0xA50\text{x}A5 with key 0x3C0\text{x}3C. What is the ciphertext byte?

Example 34

hard
RSA uses modulus n=pqn=pq where p,qp,q are large primes. Why does breaking RSA require ___?

Example 35

hard
A digital signature uses Alice's ___ key to sign and verifiers use Alice's ___ key.

Example 36

challenge
Decrypt `WKLV LV IXQ` (Caesar shift +3+3, spaces preserved).

Example 37

challenge
You see Caesar ciphertext where 'E' would normally be most common in English, but 'H' is most common here. Estimate the shift.

Background Knowledge

These ideas may be useful before you work through the harder examples.

cybersecurityprivacy