AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Making and breaking codes

Week 23 · Unit 9: Sending secret messages · 3 lessons
3

Shift the alphabet

Computing 3: Unit 9, pp. 135–146
GoalUse a shift code to change letters into other letters and back again.
New words
shift · the number of places we move along the alphabetshift code · a code that swaps each letter for the letter a fixed number of places laterwrap round · to go back to A after Z
Explanation

In a letter-to-letter code, every letter is swapped for another letter. A shift code is an easy way to make one. We slide the alphabet along by a number of places, called the shift. With a shift of 2, A becomes C, B becomes D and C becomes E. At the end the alphabet wraps round: Y becomes A and Z becomes B. To decode, go back by the same number. If a team finds out that its shift has leaked, it picks a new shift, and then all the secret letters are different.

plainsecretACBDCEDFEGFHGIHJIKJLKMLNMOplainsecretNPOQPRQSRTSUTVUWVXWYXZYAZB
Worked examples
Plain+2Secret
ST, UU
EF, GG
AB, CC
Encode SEA with a shift of 2. Count two letters on from each one: S becomes U, E becomes G and A becomes C. The ciphertext is UGC. To decode, go back by 2: with the same shift, the ciphertext KPM becomes INK, because K, P, M go back to I, N, K.
plainsecretACBDCEDFEGFHGIHJIKJLKMLNMOplainsecretNPOQPRQSRTSUTVUWVXWYXZYAZB
Look at Z and Y with a shift of 2. They wrap round to the start of the alphabet: Z becomes B and Y becomes A. So ZOO becomes BQQ.
plainsecretADBECFDGEHFIGJHKILJMKNLOMPplainsecretNQORPSQTRUSVTWUXVYWZXAYBZC
Change the shift when it leaks. If a spy learns that the team uses a shift of 2, the team moves to a shift of 3. Now SEA becomes VHD, and not UGC as before.
Class activity

Shift wheels (in pairs): cut two paper circles, a big one and a small one. Ask an adult to join them in the middle with a paper fastener so that the small one can turn. Write A to Z round the edge of each circle, with the plain letters on the big circle and the secret letters on the small one. Turn the small circle so that C sits next to the big A. That is a shift of 2. Write a short word in plain text, then use the wheels to find each secret letter. Swap with your partner and decode. Then turn the wheel to a new shift and send the same word again.

Practice
1
Use a shift of 2 to encode TEN.
plainsecretABCDEFGHIJKLMplainsecretNOPQRSTUVWXYZ
2
Use a shift of 2 to decode FKI. Go back two letters from each.
Ciphertext
FKI
3
Use a shift of 3 to encode BUS.
plainsecretABCDEFGHIJKLMplainsecretNOPQRSTUVWXYZ
4
A team uses a shift of 2, and finds out that outsiders know it. What can the team do?