HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Kwame intercepts a message made with a shift cipher…
MediumComputer ScienceHigh School (9–10)Computer Science › Encryption and Cyber SecurityNumericalConceptualIGCSE

Kwame intercepts a message made with a shift cipher…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

Kwame intercepts a message made with a shift cipher. He does not know the key, so he tries every key, one after another, and reads the result each time. Each try takes him 222 seconds.

  1. How many different keys are worth trying? (A key of 000 or 262626 leaves the message unchanged.)
  1. What is the longest time he could need?
  1. What does this tell you about the shift cipher as a way to protect data?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

s
Need a reminder? The key ideaShowHide

Data can be intercepted on a network. Encryption turns plaintext into ciphertext with an algorithm and a key, so intercepted data is meaningless without the key; it does not stop interception. In a shift cipher, with A =0= 0=0 to Z =25= 25=25, the rule is c=(p+k) mod 26c = (p + k) \bmod 26c=(p+k)mod26.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. The keys. The keys 111 to 252525 each shift the letters differently. Key 000 (or 262626) changes nothing. So there are 252525 useful keys.

Step 2. The longest time. In the worst case he tries all of them: 25×2=50 s25 \times 2 = 50\ \text{s}25×2=50 s.

Step 3. What it shows. Trying every key is called a brute-force attack. Here it takes under a minute by hand, and no time at all for a computer. A safe method needs so many possible keys that trying them all is impossible.

Answer: (a) 252525. (b) 50 s50\ \text{s}50 s. (c) The shift cipher is far too weak: it has too few keys.

Log in to save this for later
← All Problems
← Priya encrypts the word MEET with a shift cipher and the key 4…An attacker learns that, with a certain shift cipher key, the letter S was encrypted as B… →
More onComputer Science › Encryption and Cyber Security

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. A teacher wants each of her 30 students to be able to send her a private message that no other…Hard
  2. This is a toy model with tiny numbers. The exam does not ask for this calculation…Medium
  3. A company has 12 staff, and each has an asymmetric key pair…Easy
  4. A class of 20 students wants every student to be able to send a private message to every other…Hard
  5. Five members of a project team each want to send private messages to every other member, using…Medium
All problems on this topic →