Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
6.6. Cryptography Basics¶
Time Estimate: 90 minutes
6.6.1. Introduction and Goals¶
In the preceding lesson, you built a Caesar Cipher app and learned that cryptography means secret writing. It is the art and science of sending secret messages and it has been used by generals and governments and everyday people practically since the invention of written language.
As we will see in this lesson, modern cryptographic techniques are essential to guaranteeing the security of our transactions on the Internet. Cryptography plays a role whenever you make an online purchase at Amazon or provide your password to Google. If we couldn't rely on those transactions being secure -- i.e., being encrypted using some cryptographic algorithm -- we wouldn't have the Internet as we know it today.
This lesson focuses on some of the classical ciphers that followed the Caesar Cipher, which Julius Caesar used in 34 B.C. Like the Caesar cipher, the other ciphers we will study in this lesson will use symmetric encryption, which means that the same key is used both for encrypting and decrypting messages. As we will also see, all ciphers consist of two parts, the key and their algorithm. And it is the key, not the algorithm, that allows the cipher to create secret messages. In fact, in modern cryptography the algorithms are all based on open standards that are created by teams of experts, discussed openly and adopted and maintained by standards organizations.
- perform frequency analyses to identify substitution and transposition ciphers
- encrypt and decrypt messages using Vigenere Cipher
- describe the key exchange problem
- explain how substitution ciphers can be broken
- use target vocabulary, such as frequency analysis, polyalphabetic substitution, one time pad, and key exchange problem while describing symmetric encryption ciphers, with the support of concept definitions and vocabulary notes from this lesson
6.6.2. Learning Activities¶
Let's take a look at some of the classical ciphers and some of the basic principles of cryptography. There are several hands-on activities in this lesson, where you'll have a chance to practice encrypting and decrypting messages and analyzing ciphers.
Part 1: Simple Substitution Cipher
Activity: Simple Substitution Cipher
- By Hand. Use a simple substitution cipher to encrypt your name. Choose your own keyword to create a cipher alphabet. Then use the widget above to check your result.
- Decrypt. The following word, SIRTQSMTCKJ, was encrypted with the keyword simple. Can you decrypt it?
- Brute force attack. How many keys (arrangements of the alphabet) would you have to try to perform a brute force attack?
Part 2: Frequency Analysis
Activity: Frequency Analysis
Frequency analysis. One of the following messages was encrypted using a substitution cipher and the other with a transposition cipher. Can you identify which is which? Paste the messages into the frequency analyzer tool (above) and observe their frequency histograms.Text 1.
nybfx ymjgj xytky nrjxn ybfxy mjbtw xytky nrjx nybfx ymjfl jtkbn xitrn ybfxy mjflj tkktt qnxms jxxn ybfxy mjjut hmtkg jqnjk nybfx ymjju thmtk nshwj izqny dnyb fxymj xjfxt stkqn lmyny bfxym jxjfx tstki fwpsj xxny bfxym jxuwn sltkm tujny bfxym jbnsy jwtki jxufn wbjm fijaj wdymn slgjk twjzx bjmfi stymn slgjk twjzx bjbj wjfqq ltnsl inwjh yytmj fajsb jbjwj fqqlt nslin wjhy ymjty mjwbf dnsxm twyym jujwn tibfx xtkfw qnpjy mjuwj xjsy ujwnt iymfy xtrjt knyxs tnxnj xyfzy mtwny njxns xnxyj itsny xgjn slwjh jnaji ktwlt titwk twjan qnsym jxzuj wqfyn ajijl wjjt khtru fwnxt stsqd
ttbti swhot istta osmwh gflhs tsecf liaho ondia henit ahena nwtpnf ewtie fpree rhbou hnhbo uerli deovw rlode oeasr hrdsa itrei ttein ittie ntote gceoo rrits etegc psoya hsfmt sesfm iahew dtseo oiewh pheet tecir uytss sohts ssoks isero oisen oeawa vtnee watne ewagn rtenw egnit htwih tpiao reeet eoaoo sieuo tiiei ieidg dfvih pliee omrol setet wtese iotao siaoo fwphe lwtof wtofs tsipt wtsid egfed gfweo gtaea grehn oeofl psrdm fssri sdbnv foone avefi nweoi arowg fiaef nsteb isefc tieag ieare ahgha hrdhy irsoi rseli ceeli ctryt ewskh nphst oahss nsrer oelur droan
Part 3: Vigenere Cipher
Activity: Vigenere Cipher(Open widget in separate window)
- By Hand. Use the Vigenere cipher to encrypt your name. Choose your own keyword.
- Decrypt the following message, which was encrypted using Vigenere Cipher, with the keyword zebras.
SLJJ IK OSMPADOLBSELHG
- Frequency Analysis. Use the Frequency Analyzer tool (above) to count the letter frequencies in the following text, which is the same text that was encrypted in an earlier exercise. In this case it was encrypted using Vigenere Cipher. What differences do you observe from the histograms you used in the previous exercise?
sabjt zdffj tgexj dekhx xrslg ixfrk ssgki edwj kwsrx ivayd sgnik csnzt ozwuy esfip wfgnp jjhfd wtzt ozwuy ewosd yoxai mzexh xxrsl gifgo ugsgz nuqie llasc jkws rxivs wzwpe oxhki kilve tkhwr ibjof njbik fdwt ztozw uyeko vjegg elpge asabj tzdaj etwqs gueko ejiw wgeev vwqcu yifff fwojd ytnez zhoft zhrhs exnvf lsod afies kphfi ffhji eusxp vandr xvwwq ibcly nmoxd aqidk tzds uyejv ezznk gsskt zdtfi igcab jsgee scicd xivpj dwfet hdvj fdlge ujoed sgztk msjji wrxbl tznvj kiwrm ojiks iefna swcv iffvf teaui ewojf spuoj essvv akmok hwryq vrdzx jmevd ksve gegpd psqmt fngmp z
Part 4: Perfect Secrecy and the Key Exchange Problem
In this lesson, you learned how to:
6.6.4. Still Curious¶
- Read more about the historical evolution of ciphers in Chapter 5 of Blown to Bits (pg. 166+)
- You can find more cryptography challenges at CryptoClub.org.
- Here is a crypto challenge game at Khan Academy.
- If you want an additional challenge, try creating an app that does Simple Substitution. It will be similar to the Caesar Cipher App you made in Unit 5. Or try incorporating an encryption scheme into one of your own apps.
Here is a table of some of the technical terms discussed in this lesson. Hover over the terms to review the definitions.
brute force attack
one time pad
key exchange problem
6.6.6. Reflection: For Your Portfolio¶
Answer the following portfolio reflection questions as directed by your instructor. Questions are also available in this Google Doc where you may use File/Make a Copy to make your own editable copy.