!
Junior'High'Computer'Science'
2016
So what is Cryptography? Cryptography is the
science of providing security for information. It has
been used historically as a means of providing secure
communication between individuals, government
agencies, and military forces. Today, cryptography is a
cornerstone of the modern security technologies used
to protect information and resources on both open and
closed networks.
Cryptography is both the practice and study of the
techniques used to communicate and/or store
information or data privately and securely, without being intercepted by third parties.
This can include processes such as encryption, hashing, and steganography.
Cryptography is a broad field with applications in many critical areas of our lives.
So why are we looking at Cryptography in computer science? Because cryptography is
the basis of how computer security works. In computer science we use cryptography to
store information or data privately in encryption, hashing and steganography.
We use it in:
Network packets
Proxy Servers
Virtual Packet Networks (VPN)
File Transfer Packets (FTP)
Printers - Laser
Digital Pictures - Meta Data
KHAN ACADEMY
https://
www.khanacademy.org/
computing/computer-
science/cryptography/crypt/
v/intro-to-cryptography
Steganography is the art and practice of communicating using hidden messages, often
disguised within something else where one would not expect a message to be
contained in. Generally steganographic messages will appear ordinary at first glance,
however upon closer inspection or some additional knowledge about the item at hand, a
knowledgeable individual could discern the hidden steganographic message.
Steganographic messages are also commonly
hidden inside of digital media – often images or
audio. The reason being is that, even if
suspected, they are very hard to detect as there
are plentiful different ways they could be
implemented. For example, a bitmap image
may have 8 bits representing each of the three
color values (red, green, and blue) for each
pixel. If we consider just the blue there will be 8
binary bits for the amount of blue in that
particular pixel. The difference between
11111111 and 11111110 in the value for blue
intensity is likely to be undetectable by the human eye. If we modify the least significant
bit (the last bit) in each byte for each color, that gives of potentially hundreds of bytes of
information storage, and yet the overall appearance of the image will remain
unchanged.
CAESAR CYPHER
A Caesar cipher is one of the simplest (and easiest cracked) encryption methods. It is a
Substitution Cipher that involves replacing each letter of the secret message with a
different letter of the alphabet which is a fixed number of positions further in the
alphabet.
Because each letter in the message has a direct translation to another letter, frequency
analysis can be used to decipher the message. For example, the letter E is the most
commonly used letter in the English language. Thus, if the most common letter in a
secret message is K, it is likely that K represents E. Additionally, common word endings
such as ING, LY, and ES also give clues.
A brute-force approach of trying all 25 possible combinations would also work to
decipher the message.
Example
In this example, each letter in the plaintext message has been shifted 3 letters down in
the alphabet.
Plaintext: This is a secret message
Ciphertext: wklv lv d vhfuhw phvvdjh
!
KHAN ACADEMY VIDEO
https://www.khanacademy.org/
computing/computer-science/
cryptography/crypt/v/intro-to-
cryptography
NUMBERS STAND FOR LETTERS CODE
This is a very easy code to solve! Each number stands for a letter.
1 stands for A
2 stands for B
3 stands for C
and so on.
So if I tell you the number is 10, you count ten letters into the alphabet:
"A B C D E F G H I J", and you get a J.
To help solve this code a bit quicker, you can write out the whole alphabet, and then
write out the numbers from 1 to 26 below each letter.
A B C D E F G H I J K L M
1 2 3 4 5 6 7 8 9 10 11 12 13
N O P Q R S T U V W X Y Z
14 15 16 17 18 19 20 21 22 23 24 25 26
Now, whenever you see a number, you can either count that many letters, or look up the
number and write down the letter above it.
Example:
SCOUT = 19 3 15 21 20
ghi
2 3
4 5 6 7 8 9 : ; < = > ?
@
A
B
C D E F G H I J K
3
4 5 6 7 8 9 : ; < = > ?
@
A
B
C D E F G H I J K 2
4 5 6 7 8 9 : ; < = > ?
@
A
B
C D E F G H I J K 2 3
5 6 7 8 9 : ; < = > ?
@
A
B
C D E F G H I J K 2 3 4
6 7 8 9 : ; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
67 8 9 : ; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7
8
9 : ; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8
9
: ; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9: ; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 :; < = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;< = > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;
<
= > ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;
< =
> ?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;
< =
>
?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;
< =
>
?
@
A
B
C D E F G H I J K 2 3 4 5
6 7 8 9 : ;
<
=
>
@
A
B
C D E F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B C D E F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C D E F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
CD E F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F G H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F
G
H I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F
G
H
I J K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F
G
H
I J
K 2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F
G
H
I
J K
2 3 4 5
?
6 7 8 9 : ;
< =
>
@
A
B
C
D
E
F
G
H
I
J
K 2 3 4 5
?
P Q
R S T U V W X Y Z [ \ ]
^
_
`
a b c d e
f
{
r
s
t
u
v
w
x
y
z
r{
rr
rs
rt
ru
rv
rw
rx
ry
rz
s{
sr
ss
st
su
sv
GXVT]!aTD`dPaT
{
r s
t
u
v
w
x y
z
r{ rr
rs
rt ru
rv
rw rx
ry
rz s{
sr
ss st
su
sv
P
Q R
S
T U
V
W X
Y
Z [
\
] ^
_
` a
b
c d
e
f g
h
i
=TccTac^?d\QTaEPQ[T
www.cryptoclub.org
VIGENERE CYPHER
Blaise de Vigenère developed a square to help encode messages. Reading along each
row, you can see that it is a really a series of Caesar ciphers the first has a shift of 1, the
second a shift of 2 and so.
The Vigenère cipher uses this table in conjunction with a key to encipher a message.
So, if we were to encode a message using the key COUNTON, we write it as many
times as necessary above our message. To find the encryption, we take the letter from
the
intersection of the Key letter row, and the Plaintext letter column
To decipher the message, the recipient needs to write out the key above the ciphertext
and reverse the process.
KHAN ACADEMY
Vigenère cipher
https://www.khanacademy.org/
computing/computer-science/
cryptography/crypt/v/
polyalphabetic-cipher
The maths behind the Vigenère
cipher can be written as follows:
To encrypt a message: Ca = Ma +
Kb (mod 26)
To decrypt a message: Ma = Ca –
Kb (mod 26)
(Where C = Code, M = Message, K
= Key, and where a = the ath
character of the message bounded
by the message, and b is the bth
character of the Key bounded by
the length of the key.)
KEYWORD CYPHER
A keyword cipher is a form of monoalphabetic substitution. A keyword is used as the
key, and it determines the letter matchings of the cipher alphabet to the plain alphabet.
Repeats of letters in the word are removed, then the cipher alphabet is generated with
the keyword matching to A,B,C etc. until the keyword is used up, whereupon the rest of
the ciphertext letters are used in alphabetical order, excluding those already used in the
key.
With KRYPTOS as the keyword, all As become Ks, all Bs become Rs and so on.
Encrypting the message "knowledge is power" using the keyword "kryptos":
Only one alphabet is used here, so the cipher is monoalphabetic.
The best ways to attack a keyword cipher without knowing the keyword are through
known-plaintext attack, frequency analysis and discovery of the keyword (often a
cryptanalyst will combine all three techniques). Keyword discovery allows immediate
decryption since the table can be made immediately.
!
KHAN ACADEMY"
The One Time Pad
https://www.khanacademy.org/
computing/computer-science/
cryptography/crypt/v/one-time-
pad
CRYPTOGRAPH WHEEL
You can make a special Cryptograph Wheel to solve cryptographs (see the picture!)
First make two circles of cardboard, one a bit smaller than the other, and use a
protractor to mark them off into 26 pieces of about 13.8 degrees each. Write one letter
of the alphabet in each division on each wheel.
Then attach the two wheels together using a split pin so that you can rotate them
independently.
Now if you want to solve a cryptograph where the alphabet slides along by 3 places, just
rotate the wheel so that A is opposite the C, and then you can read the code letters off
the wheel.
The Cryptograph Wheel below was published in 1869. It is slightly more complicated
than ours, because the letters are in a random order.
Use the wheel on the next page to create your cryptograph wheel.!
KHAN ACADEMY"
The Enigma Encryption Machine
https://www.khanacademy.org/
computing/computer-science/
cryptography/crypt/v/case-study-
ww2-encryption-machines
November
Oscar
Papa
Quebec
Romeo
Sierra
Tango
Uniform
Victor
Whiskey
X-ray
Yankee
Zulu
BRAILLE
Braille is another substitution cipher - but it's not intended to keep things secret! Braille
is specially designed to print letters using a grid of up to six raised dots, so that a blind
person can read the letter by running their fingers over it.
(Image from Wikimedia Commons)
Here's a code for you to solve:
MORSE CODE"
Morse Code is just a simple substitution code, like all the others!
(table from Scouting for Boys)
Morse Code is sometimes written with a slash (/) between letters, to stop you from
getting the letters confused. A double slash (//) means a break between words.
Example:
SOS = .../---/...
Here's a code for you to solve:
..//-./././-..//.-//--/.-/.--.//---/..-.//-/...././/.-/.-././.-//../--/--/./-../../.-/-/./.-../-.--//
PIGPEN CIPHER
The Pigpen code (also sometimes called the Freemason's or Rosicrician cipher) is quite
easy to catch on to. First you write out the whole alphabet in two grids, as shown:
Each letter is represented by the part of the "pigpen" that surrounds it. If it's the second
letter in the box, then it has a dot in the middle.
Example:
This is decoded as "LISTEN TO THE WIND".
BLOCK CIPHER
We write the message in a rectangular block, one row at a time, and then read off the
columns.
Example:
To encode the message THIS IS VERY EASY!, write it in a block like this:
The coded message is read by looking at the columns, and writing them out like this:
TSE HVA IES SRY IY!
To decode it, just write all the code words in a block again, as columns, and then read
the message across the rows.
!
PARAGRAPH-WORD-LETTER
This type of code needs to refer to a specific piece of text, for instance the first page of
your Science textbook, or the front page article on today's newspaper. Each triple of
numbers gives which number paragraph, word and letter to use.
For instance, if this explanation is used to solve the code, 1.3.2 would mean the first
paragraph (above) third word (of) second letter (F). And 2.5.1 would refer to the second
paragraph (this one), 5th word (used), first letter (U).
Once you're started, it's easy:
Example:
1.5.5 2.2.7 1.4.2 2.8.2 1.1.1 = SCOUT
Another example:
Sometimes the code will refer to whole words instead of letters:
1.1 1.4 2.6 1.9 3.5 = "This code is easy"
References
Microsoft TechNet - https://technet.microsoft.com/en-us/library/cc962030.aspx
Khan Academy Videos
Wikipedia -
https://en.wikipedia.org/wiki/Keyword_cipher
Code Breaking - http://www.counton.org/explorer/codebreaking/vigenere-cipher.php
Secret Codes for Cubs and Scouts - https://sites.google.com/site/codesforscouts/
cryptogram
Spies, Lies and Codes - http://www.education.txstate.edu/ci/faculty/dickinson/PBI/
PBIFall05/Cryptography2/Content/intro.htm
Crypto Club - http://cryptoclub.org/tools/ciphers.php
Learn Cryptography - https://learncryptography.com