Sie sind auf Seite 1von 16

HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML

Hill Cipher MONOALPHABETIC


SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)

Cipher Activity SIMPLE


Introduction TRANSPOSITION
CIPHERS
(/SIMPLE-
Encryption TRANSPOSITION-
CIPHERS.HTML)
2 x 2 Matrix Encryption
3 x 3 Matrix Encryption POLYALPHABETIC
SUBSTITUTION
CRYPTO
DecryptionCORNER CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
2 x 2 Matrix Decryption CIPHERS.HTML)

3 x 3 Matrix Decryption
FRACTIONATING
Discussion CIPHERS
(/FRACTIONATING-
Inverse Matrix Activity CIPHERS.HTML)

Exercise DIGRAPH
SUBSTITUTION
CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)

The Hill Cipher was invented by Lester S. Hill in 1929, and like the other
GLOSSARY
Digraphic Ciphers (/digraph-substitution-ciphers.html) it (/GLOSSARY.HTML)
acts on groups of
letters. Unlike the others though it is extendable to work on dierent sized
HELP WITH
blocks of letters. So, technically it is a polygraphic substitution cipher, as it can
ACTIVITIES
(/HELP-WITH-
work on digraphs, trigraphs (3 letter blocks) or theoretically ACTIVITIES.HTML)
any sized blocks.

The Hill Cipher uses an area of mathematics called Linear Algebra


(http://en.wikipedia.org/wiki/Linear_algebra), and in particular requires the
user to have an elementary understanding of matrices
(http://en.wikipedia.org/wiki/Matrix_%28mathematics%29). It also make
use of Modulo Arithmetic (http://en.wikipedia.org
/wiki/Modular_arithmetic) (like the Ane Cipher (/ane-cipher.html)).
Because of this, the cipher has a signicantly more mathematical nature than
some of the others. However, it is this nature that allows it to act (relatively)
easily on larger blocks of letters.

In the examples given, we shall walk through all the steps to use this cipher to
act on digraphs and trigraphs. It can be extended further, but this then
requires a much deeper knowledge of the background mathematics. Some
important concepts are used throughout: Matrix Multiplication
HOME (/)
(http://en.wikipedia.org/wiki/Matrix_multiplication); Modular Inverses
(http://en.wikipedia.org/wiki/Modular_multiplicative_inverse);
INTRODUCTION TO
CRYPTOGRAPHY
Determinants of Matrices (http://en.wikipedia.org/wiki/Determinant);
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML
Matrix Adjugates (http://en.wikipedia.org/wiki/Adjugate_matrix) (for
nding inverses). MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
Encryption CIPHERS.HTML)

To encrypt a message using the Hill Cipher we must rst turn our keyword into
SIMPLE
a key matrix (a 2 x 2 matrix for working with digraphs, a 3 x 3 matrix for
TRANSPOSITION
CIPHERS
working with trigraphs, etc). We also turn the plaintext (/SIMPLE-
into digraphs (or
TRANSPOSITION-
CIPHERS.HTML)
trigraphs) and each of these into a column vector. We then perform matrix
multiplication modulo the length of the alphabet (i.e. 26) on POLYALPHABETIC
each vector. These
SUBSTITUTION
CRYPTO CORNER
vectors are then converted back into letters to produce the ciphertext.
CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
CIPHERS.HTML)
2 x 2 Example
FRACTIONATING
We shall encrypt the plaintext message "short CIPHERS
(/FRACTIONATING-
example" using the keyword hill and a 2 x 2 matrix. The CIPHERS.HTML)

rst step is to turn the keyword into a matrix. If the


DIGRAPH
(/uploads/1/1/3
keyword was longer than the 4 letters needed, we SUBSTITUTION
/4/11345755
CIPHERS
would only take the rst 4 letters, and if it was shorter, (/DIGRAPH-
/6927231_orig.jpg)
SUBSTITUTION-
The keyword written
CIPHERS.HTML)
we would ll it up with the alphabet in order (much like
as a matrix.
a Mixed Alphabet (/mixed-alphabet-cipher.html)).
GLOSSARY
(/GLOSSARY.HTML)

With the keyword in a matrix, we need to convert this


HELP WITH
ACTIVITIES
into a key matrix. We do this by converting each letter (/HELP-WITH-
ACTIVITIES.HTML)
into a number by its position in the alphabet (starting
at 0). So, A = 0, B = 1, C= 2, D = 3, etc.
(/uploads/1/1/3
/4/11345755
/2127724_orig.jpg)
The key matrix (each
letter of the
keyword is
converted to a
number).

We now split the plaintext into digraphs, and write these as column vectors.
That is, in the rst column vector we write the rst plaintext letter at the top,
and the second letter at the bottom. Then we move to the next column vector,
where the third plaintext letter goes at the top, and the fourth at the bottom.
This continues for the whole plaintext.
HOME (/)

(/uploads/1/1/3/4/11345755
INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
/3874131_orig.jpg) CRYPTOGRAPHY.HTML
The plaintext "short example" split into column vectors.
MONOALPHABETIC
Now we must convert the plaintext column vectors in the same way that we
SUBSTITUTION
CIPHERS
converted the keyword into the key matrix. Each letter (/MONOALPHABETIC-
is replaced by its
SUBSTITUTION-
appropriate number. CIPHERS.HTML)

SIMPLE
TRANSPOSITION
CIPHERS
(/SIMPLE-
TRANSPOSITION-
CIPHERS.HTML)

POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) (/uploads/1/1/3/4/11345755/9504506_orig.jpg) SUBSTITUTION-
CIPHERS.HTML)
The plaintext converted into numeric column vectors.

Now we must perform some matrix multiplication. We multiply the key matrix
FRACTIONATING
CIPHERS
by each column vector in turn. We shall go through the rst(/FRACTIONATING-
of these in detail,
CIPHERS.HTML)
then the rest shall be presented in less detail. We write the key matrix rst,
followed by the column vector. DIGRAPH
SUBSTITUTION
CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)

GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

To perform matrix multiplication we "combine" the top row of the key matrix
with the column vector to get the top element of the resulting column vector.
We then "combine" the bottom row of the key matrix with the column vector
to get the bottom element of the resulting column vector. The way we
"combine" the four numbers to get a single number is that we multiply the rst
element of the key matrix row by the top element of the column vector, and
multiply the second element of the key matrix row by the bottom element of
the column vector. We then add together these two answers.
That is, we follow the rules given by
HOME (/)
the algebraic method shown to the
left. INTRODUCTION TO
CRYPTOGRAPHY
(/uploads/1/1/3/4/11345755 (/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML
/4654040_orig.jpg)
The algebraic rules of matrix
multiplication. MONOALPHABETIC
SUBSTITUTION
CIPHERS
In our case we perform the two (/MONOALPHABETIC-
SUBSTITUTION-
calculations on the right. We then CIPHERS.HTML)

right these two answers out in a


SIMPLE
column vector as shown below. TRANSPOSITION
(/uploads/1/1/3/4/11345755
CIPHERS
/6927816_orig.jpg)
(/SIMPLE-
TRANSPOSITION-
The calculations performed when doing
CIPHERS.HTML)
a matrix multiplication.

POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
CIPHERS.HTML)

FRACTIONATING
CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)
(/uploads/1/1/3/4/11345755/9802105_orig.jpg)
The shorthand for the matrix multiplication. DIGRAPH
SUBSTITUTION
CIPHERS
Next we have to take each of these numbers, in our resultant column vector,
(/DIGRAPH-
SUBSTITUTION-
modulo 26 (remember that means divide by 26 and take theCIPHERS.HTML)
remainder).

GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

(/uploads/1/1/3/4/11345755/4006075_orig.jpg)
Reducing the resultant column vector modulo 26.

Finally we have to convert these numbers back to letters, so 0 becomes "A"


and 15 becomes "P", and our rst two letters of the ciphertext are "AP".

(/uploads/1/1/3/4/11345755/9900824_orig.jpg)
The whole calculation: converting to numbers; the matrix multiplication; reducing
modulo 26; converting back to letters.
Encryption process of the rst digraph.
HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML

MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)
1 2 3 4 5 6

SIMPLE
TRANSPOSITION
This gives us a nal ciphertext of "APADJ TFTWLFJ". CIPHERS
(/SIMPLE-
TRANSPOSITION-
CIPHERS.HTML)
3 x 3 Example
We shall encrypt the plaintext message "retreat now" POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER
using the keyphrase back up and a 3 x 3 matrix. The CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
rst step is to turn the key phrase into a matrix. Notice CIPHERS.HTML)

that the key phrase is a few letters short, so we ll in (/uploads/1/1/3


/4/11345755
FRACTIONATING
the nal elements with the start of the alphabet. /8884682_orig.jpg)
CIPHERS
(/FRACTIONATING-
The keyword written
CIPHERS.HTML)
as a matrix.

Now we turn the keyword matrix into the key matrix by DIGRAPH
SUBSTITUTION
replacing letters with their numeric values. CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)

(/uploads/1/1/3
GLOSSARY
/4/11345755
(/GLOSSARY.HTML)
/4710959_orig.jpg)
The Key Matrix
obtained
HELP WITH by taking
ACTIVITIES
(/HELP-WITH- values
the numeric
of the letters of the
ACTIVITIES.HTML)
key phrase.

Now we split the plaintext into trigraphs (we are using a 3 x 3 matrix so we
need groups of 3 letters), and convert these into column vectors. However,
since the plaintext does not go perfectly into the column vectors, we need to
use some nulls to make the plaintext the right length. We then convert these
into numeric column vectors.
HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML
(/uploads/1/1/3/4/11345755
/816249_orig.jpg)
(/uploads/1/1/3/4/11345755 MONOALPHABETIC
The plaintext converted into numeric
SUBSTITUTION
/7852819_orig.jpg) column CIPHERS
vectors.
The plaintext split into trigraphs and (/MONOALPHABETIC-
SUBSTITUTION-
written in column vectors. Note the nulls CIPHERS.HTML)
added to make it the right length

Now we perform matrix multiplication, SIMPLE


TRANSPOSITION
multiplying the key matrix by each column CIPHERS
(/SIMPLE-
TRANSPOSITION-
vector in turn. To perform matrix CIPHERS.HTML)

multiplication we "combine" the top row of


(/uploads/1/1/3
POLYALPHABETIC
the key matrix with the column vector to get /4/11345755
SUBSTITUTION
CRYPTO CORNER CIPHERS
/3017435_orig.jpg)
the
(/) top element of the resulting column (/POLYALPHABETIC-
The first matrix mltiplication.
SUBSTITUTION-
vector. We then "combine" the middle row of CIPHERS.HTML)

the key matrix with the column vector to get


FRACTIONATING
the middle element of the resulting column CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)
vector. and similarly for the bottom row. The
way we "combine" the six numbers to get a
DIGRAPH
SUBSTITUTION
single number is that we multiply the rst CIPHERS
(/DIGRAPH-
element of the key matrix row by the top SUBSTITUTION-
CIPHERS.HTML)
element of the column vector, multiply the
second element of the key matrix row by the GLOSSARY
(/GLOSSARY.HTML)
middle element of the column vector, and
multiply the third element of the key matrix HELP WITH
ACTIVITIES
row by the bottom element of the column (/HELP-WITH-
ACTIVITIES.HTML)
vector. We then add together these three
answers.

(/uploads/1/1/3/4/11345755/9506348_orig.jpg)
Algebraic representation of matrix multiplication for a 3 x 3 matrix.

We then follow the same process as for the 2 x 2 Matrix Example. We perform
all the matrix multiplcations, and take the column vectors modulo 26. Then we
convert them back into letters to produce the ciphertext.
HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML

MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)

SIMPLE
TRANSPOSITION
Encryption of the rst trigraph. CIPHERS
(/SIMPLE-
TRANSPOSITION-
1 2 3 4 CIPHERS.HTML)

This gives us a nal ciphertext of "DPQRQ EVKPQ LR". POLYALPHABETIC


SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
Decryption CIPHERS.HTML)

To decrypt a ciphertext encoded using the Hill Cipher, we must nd the inverse
FRACTIONATING
matrix. Once we have the inverse matrix, the processCIPHERS
is the same as
(/FRACTIONATING-
CIPHERS.HTML)
encrypting. That is we multiply the inverse key matrix by the column vectors
that the ciphertext is split into, take the results modulo the length of the
DIGRAPH
SUBSTITUTION
alphabet, and nally convert the numbers back to letters. CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)
Since the majority of the process is the same as encryption, we are going ot
focus on nding the inverse key matrix (not an easy task), GLOSSARY
and will then skim
(/GLOSSARY.HTML)
quickly through the other steps (for more information see Encryption above).
HELP WITH
ACTIVITIES
In general, to nd the inverse of the key matrix, we (/HELP-WITH-
perform the calculation
ACTIVITIES.HTML)
below, where K is the key matrix, d is the determinant of the key matrix and
adj(K) is the adjugate matrix of K.

(/uploads/1/1/3/4/11345755/867635_orig.jpg)
General method to calculate the inverse key matrix.
2 x 2 Example
HOME (/)
We shall decrypt the example above, so we are using
the keyword hill and our ciphertext is "APADJ INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
TFTWLFJ". We start by writing out the keyword as a CRYPTOGRAPHY.HTML
matrix and converting this into a key matrix as for (/uploads/1/1/3
/4/11345755
MONOALPHABETIC
encryption. Now we must convert this to the inverse /___6927231_orig.jpg)
SUBSTITUTION
CIPHERS
The keyword written
key matrix, for which there are several steps. (/MONOALPHABETIC-
as a matrix.
SUBSTITUTION-
CIPHERS.HTML)

SIMPLE
TRANSPOSITION
CIPHERS
(/SIMPLE-
TRANSPOSITION-
CIPHERS.HTML)
(/uploads/1/1/3
/4/11345755
/_2127724_orig.jpg)
POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER The key matrix (each
CIPHERS
letter of the
(/POLYALPHABETIC-
(/) SUBSTITUTION-
keyword is
CIPHERS.HTML)
converted to a
number).
FRACTIONATING
Step 1 - Find the Multiplicative Inverse of the Determinant CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)
The determinant (http://en.wikipedia.org/wiki/Determinant) is a number
that relates directly to the entries of the matrix. It is found by multiplying the
DIGRAPH
SUBSTITUTION
top left number by the bottom right number and subtracting from this the
CIPHERS
(/DIGRAPH-
product of the top right number and the bottom left number. This is shown
SUBSTITUTION-
CIPHERS.HTML)
algebraically below. Note that the notation for determinant has straight lines
instead of brackets around our matrix. GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

(/uploads/1/1/3/4/11345755/4533438_orig.jpg)
Algebraic method to calculate the determinant of a 2 x 2 matrix.

Once we have found this value, we need to take the number modulo 26. Below
is the way to calculate the determinant for our example.

(/uploads/1/1/3/4/11345755/6449828_orig.jpg)
Calculating the determinant of our 2 x 2 key matrix.
We now have to nd the multiplicative inverse
HOME (/)
of the determinant working modulo
(http://en.wikipedia.org (/uploads/1/1/3
INTRODUCTION TO
/4/11345755
CRYPTOGRAPHY
/wiki/Modular_multiplicative_inverse) 26. (/INTRODUCTION-TO-
/859481_orig.jpg)
CRYPTOGRAPHY.HTML
If d is the determinant, then
That is, the number between 1 and 25 that
we are looking for the inverse
gives an answer of 1 when we multiply it by the of d.
MONOALPHABETIC
SUBSTITUTION
CIPHERS
determinant. So, in this case, we are looking for (/MONOALPHABETIC-
SUBSTITUTION-
the number that we need to multiply 15 by to CIPHERS.HTML)

get an answer of 1 modulo 26. There are (/uploads/1/1/3


/4/11345755
SIMPLE
algorithms to calculate this, but it is often /5190131_orig.jpg)
TRANSPOSITION
CIPHERS inverse is
The multiplicative
easiest to use trial and error to nd the inverse. (/SIMPLE-
the number we multiply 15
TRANSPOSITION-
by to CIPHERS.HTML)
get 1 modulo 26.

POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
CIPHERS.HTML)

(/uploads/1/1/3/4/11345755/2704112_orig.jpg)
This calculation gives us an answer of 1 modulo 26.
FRACTIONATING
CIPHERS
So the multiplicative inverse of the determinant modulo 26 (/FRACTIONATING-
is 7. We shall need
CIPHERS.HTML)
this number later.
DIGRAPH
SUBSTITUTION
CIPHERS
Step 2 - Find the Adjugate Matrix (/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)
The adjugate matrix (http://en.wikipedia.org/wiki/Adjugate_matrix) is a
matrix of the same size as the original. For a 2 x 2 matrix, this is fairly
GLOSSARY
straightforward as it is just moving the elements to dierent positions and
(/GLOSSARY.HTML)

changing a couple of signs. That is, we swap the top left and bottom right
HELP WITH
numbers in the key matrix, and change the sign of the ACTIVITIES
the top right and
(/HELP-WITH-
ACTIVITIES.HTML)
bottom left numbers. Algebraically this is given below.

(/uploads/1/1/3/4/11345755/2475976_orig.jpg)
The adjugate matrix of a 2 x 2 matrix.

Again, once we have these values we will need to take each of them modulo
26 (in particular, we need to add 26 to the negative values to get a number
between 0 and 25. For our example we get the matrix below.
HOME (/)
(/uploads
INTRODUCTION TO
CRYPTOGRAPHY
/1/1/3/4/11345755/8133953_orig.jpg) (/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML
The adjugate matrix of the key matrix.

Step 3 - Multiply the Multiplicative Inverse of the Determinant by the Adjugate


MONOALPHABETIC
SUBSTITUTION
Matrix CIPHERS
(/MONOALPHABETIC-
To get the inverse key matrix, we now multiply the inverseSUBSTITUTION-
determinant (that
CIPHERS.HTML)
was 7 in our case) from step 1 by each of the elements of the adjugate matrix
from step 2. Then we take each of these answers modulo 26.SIMPLE
TRANSPOSITION
CIPHERS
(/SIMPLE-
TRANSPOSITION-
CIPHERS.HTML)

POLYALPHABETIC
SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) (/uploads/1/1/3/4/11345755/3227655_orig.jpg) SUBSTITUTION-
Multiplying the multiplicative inverse of the determinant by the adjugate to get the
CIPHERS.HTML)
inverse key matrix.

That is: FRACTIONATING


CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)

DIGRAPH
SUBSTITUTION
CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)

Now we have the inverse key matrix, we have to convert the ciphertext into
GLOSSARY
column vectors and multiply the inverse matrix by each column vector in turn,
(/GLOSSARY.HTML)

take the results modulo 26 and convert these back into letters to get the
HELP WITH
plaintext. ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

The decryption of the rst digraph.

1 2 3 4 5 6

We get back our plaintext of "short example".


3 x 3 Example
HOME (/)
We shall decrypt the ciphertext message "SYICHOLER"
using the keyword alphabet. The rst step is to turn the INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
key phrase into a matrix. Notice that the keyword is a CRYPTOGRAPHY.HTML
(/uploads/1/1/3
letter short, so we ll in the nal element with the start
/4/11345755
MONOALPHABETIC
of the alphabet. Now we need to convert this into the /1999157_orig.jpg)
SUBSTITUTION
The keyword written
CIPHERS
inverse key matrix, following the same step as for a 2 x (/MONOALPHABETIC-
as a matrix.
SUBSTITUTION-
2 matrix. However, the way we calculate each step is CIPHERS.HTML)

slightly dierent.
SIMPLE
TRANSPOSITION
CIPHERS
(/SIMPLE-
TRANSPOSITION-
(/uploads/1/1/3
CIPHERS.HTML)
/4/11345755
/150388_orig.jpg)
POLYALPHABETIC
The key matrix.
SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/)
Step 1 - Find the Multiplicative Inverse of the Determinant SUBSTITUTION-
CIPHERS.HTML)
The determinant (http://en.wikipedia.org/wiki/Determinant) is a number
that relates directly to the entries of the matrix. For a 3 x 3 matrix it is found by
FRACTIONATING
CIPHERS
multiplying the top left entry by the determinant of the 2 x 2(/FRACTIONATING-
matrix formed by
CIPHERS.HTML)
the entries that are not in the same row or column as that entry (that is the 2 x
2 matrix not including the top row or left column). Similar steps are done with
DIGRAPH
SUBSTITUTION
the other two elements in the top row, and the middle valueCIPHERS
is subtracted from
(/DIGRAPH-
SUBSTITUTION-
the sum of the other two. This is shown more clearly in theCIPHERS.HTML)
algebraic version
below.
GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

(/uploads/1/1/3/4/11345755/4458084_orig.jpg)
The algebraic representation of finding the determinant of a 3 x 3 matrix.

Once we have calculated this value, we take it modulo 26.


HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML

MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)

SIMPLE
(/uploads/1/1/3/4/11345755/8073467_orig.jpg)
TRANSPOSITION
CIPHERS
Finding the determinant of the 3 x 3 matrix with keyword(/SIMPLE-
alphabet.
TRANSPOSITION-
We now have to nd the multiplicative inverse CIPHERS.HTML)

of the determinant working modulo


POLYALPHABETIC
(/uploads/1/1/3
SUBSTITUTION
CRYPTO CORNER
(http://en.wikipedia.org /4/11345755
CIPHERS
(/POLYALPHABETIC-
(/)
/wiki/Modular_multiplicative_inverse) 26. /8078788_orig.jpg)
SUBSTITUTION-
The multiplicative inverse is
CIPHERS.HTML)
That is, the number between 1 and 25 that the number we multiply 11
gives an answer of 1 when we multiply it by the by to get 1 modulo 26.
FRACTIONATING
CIPHERS
determinant. So, in this case, we are looking for (/FRACTIONATING-
CIPHERS.HTML)
the number that we need to multiply 11 by to
get an answer of 1 modulo 26. There are (/uploads/1/1/3
DIGRAPH
/4/11345755
SUBSTITUTION
algorithms to calculate this, but it is often CIPHERS
/_859481_orig.jpg)
(/DIGRAPH-
If d is the determinant, then
SUBSTITUTION-
easiest to use trial and error to nd the inverse. CIPHERS.HTML)
we are looking for the inverse
of d.
GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
(/uploads/1/1/3/4/11345755/1571506_orig.jpg)
ACTIVITIES.HTML)
Finding the multiplicative inverse of 11 modulo 26.

So the multiplicative inverse of the determinant modulo 26 is 19. We shall need


this number later.

Step 2 - Find the Adjugate Matrix


The adjugate matrix (http://en.wikipedia.org/wiki/Adjugate_matrix) is a
matrix of the same size as the original. For a 3 x 3 matrix this process is
somewhat more complex than it was for a 2 x 2 matrix. It requires us to
calculate 9 lots of 2 x 2 determinants, and assign them with the correct signs,
and put them in the correct places. The algebraic representation is given
below.
HOME (/)

INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
CRYPTOGRAPHY.HTML

MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)
(/uploads/1/1/3/4/11345755/9613397_orig.jpg)
Calculating the adjugate matrix of a 3 x 3 matrix.
SIMPLE
Although this seems a bit of a random selection of letters to place in each of
TRANSPOSITION
CIPHERS
the discriminants, it is dened as the transpose of the cofactor matrix, which is
(/SIMPLE-
TRANSPOSITION-
CIPHERS.HTML)
much easier to remember how to work out. To nd the cofactor matrix, we
take the 2 x 2 determinant in each position such that the four values in that
POLYALPHABETIC

CRYPTO
position are the four values not in the same row or columnSUBSTITUTION
CORNER as the position in
CIPHERS
(/) (/POLYALPHABETIC-
the original matrix. The adjugate is then formed by reecting the cofactor
SUBSTITUTION-
CIPHERS.HTML)
matrix along the line from top left ot bottom right.
FRACTIONATING
CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)

DIGRAPH
SUBSTITUTION
CIPHERS
(/DIGRAPH-
SUBSTITUTION-
CIPHERS.HTML)

GLOSSARY
(/GLOSSARY.HTML)
(/uploads/1/1/3/4/11345755/7457658_orig.jpg)
The cofactor matrix can be used to find the adjugate matrix. Simply reflect it along the
line from top left ot bottom right of the matrix.HELP WITH
ACTIVITIES
(/HELP-WITH-
We also need to remember to take each of our values in the adjugate matrix
ACTIVITIES.HTML)

modulo 26. So for our example we get the working below.

(/uploads/1/1/3/4/11345755/9928545_orig.jpg)
Calculating the adjugate matrix of the key matrix.
HOME (/)
Step 3 - Multiply the Multiplicative Inverse of the Determinant by the Adjugate
Matrix INTRODUCTION TO
CRYPTOGRAPHY
To get the inverse key matrix, we now multiply the inverse(/INTRODUCTION-TO-
determinant (that
CRYPTOGRAPHY.HTML
was 19 in our case) from step 1 by each of the elements of the adjugate matrix
from step 2. Then we take each of these answers modulo 26.MONOALPHABETIC
SUBSTITUTION
CIPHERS
(/MONOALPHABETIC-
SUBSTITUTION-
CIPHERS.HTML)

SIMPLE
TRANSPOSITION
CIPHERS
(/SIMPLE-
(/uploads/1/1/3/4/11345755/9529458_orig.jpg)
TRANSPOSITION-
CIPHERS.HTML)
Multiplying the inverse of the determinant by the adjugate matrix gets the inverse key
matrix.
POLYALPHABETIC
That is: SUBSTITUTION
CRYPTO CORNER CIPHERS
(/POLYALPHABETIC-
(/) SUBSTITUTION-
CIPHERS.HTML)

FRACTIONATING
CIPHERS
(/FRACTIONATING-
CIPHERS.HTML)

DIGRAPH
(/uploads/1/1/3/4/11345755/2417288_orig.jpg)
SUBSTITUTION
CIPHERS
The final relationship between the key matrix and the inverse key matrix.
(/DIGRAPH-
SUBSTITUTION-
Finally, now we have the inverse key matrix, we multiply thisCIPHERS.HTML)
by each

GLOSSARY
(/GLOSSARY.HTML)

HELP WITH
ACTIVITIES
(/HELP-WITH-
ACTIVITIES.HTML)

Decryption of the rst trigraph.

1 2 3

And we retreive our plaintext of "we are safe".

Discussion
The most important item that must be discussed regarding the use of the Hill
Cipher is that not every possible matrix is a possible key matrix. This is
because, in order to decrypt, we need to have an inverse key matrix, and not
HOME (/)
every matrix is invertible. Fortunately, we do not have to work out the entire
inverse to nd it is not possible, but simply consider the determinant.
INTRODUCTION If
TOthe
CRYPTOGRAPHY
determinant is 0 or shares a factor, other than 1, with (/INTRODUCTION-TO-
the length of the
CRYPTOGRAPHY.HTML
alphabet being used, then the matrix will not have an inverse. If this is the case,
a dierent key must be chosen, since otherwise the ciphertext will not be able
MONOALPHABETIC
SUBSTITUTION
to be decrypted. In order to be a usable key, the matrix CIPHERS
must have a non-
(/MONOALPHABETIC-
SUBSTITUTION-
zero determinant which is coprime to the length of the alphabet.
CIPHERS.HTML)

SIMPLE
The Hill Cipher requires a much larger use of mathematics than most other
TRANSPOSITION
CIPHERS
(/SIMPLE-
classical ciphers. The processes involved are relatively complex, but there are
TRANSPOSITION-
CIPHERS.HTML)
simply algorithms that need to be implemented. The process of matrix
multiplication involves only multiplication and addition. Finding an inverse is
POLYALPHABETIC
SUBSTITUTION
CRYPTO
somewhat CORNER
more complicated (especially for a 3 x 3 matrix), and the activity
CIPHERS
(/POLYALPHABETIC-
(/)
below allows you to practice working these out. SUBSTITUTION-
CIPHERS.HTML)

FRACTIONATING
CIPHERS
(/FRACTIONATING-
The security of a 2 x 2 Hill Cipher is similar (actually slightlyCIPHERS.HTML)
weaker) than the
Bid or Playfair Ciphers (/playfair-cipher.html), and it is somewhat more
DIGRAPH
SUBSTITUTION
laborious to implement by paper and pencil mmethods. However, as the key
CIPHERS
(/DIGRAPH-
matrix size increases, so does the security, and also the complexity of
SUBSTITUTION-
CIPHERS.HTML)
operating the cipher. It is possible to increase the key size further than the 3 x 3
we have discussed here, but the mathematics involved gets rapidly more
GLOSSARY
(/GLOSSARY.HTML)
complex. Hill invented a machine that would mechanically implement a 6 x 6
version of the cipher, which was very secure. Unfortunately,HELP
the WITH
machine was
ACTIVITIES
unable to change the key setting, leaving it with limited use in the real world.
(/HELP-WITH-
ACTIVITIES.HTML)

Cryptanalysis of an intercept encrypted using the Hill Cipher is certainly


possible, especially for small key sizes. For the 2 x 2 version, looking for
repeated digraphs would be the rst step, and matching the most common
ciphertext digraph to the most common digraph in English ("th") and then the
second to the second most common in English ("he") would allow the
interceptor to put together a possible key matrix acting on those four letters.
This cou

PREVIOUS PAGE: FOUR-SQUARE CIPHER NEXT PAGE: COMBINATION CIPHERS


(/four-square-cipher.html) (/combination-ciphers.html
HOME (/)

Information Crypto Corner is a If you have found


INTRODUCTION TO
CRYPTOGRAPHY
(/INTRODUCTION-TO-
subsiduary of Crypto Corner
CRYPTOGRAPHY.HTML
About Me
www.interactive- useful, then
(/about- MONOALPHABETIC
maths.com please help to
SUBSTITUTION
me.html) (http://www.interactive-
CIPHERS
keep it a free site
(/MONOALPHABETIC-
SUBSTITUTION-
Contact Me maths.com) by donating using
CIPHERS.HTML)

(/contact- the button below.


2013 - 2017Daniel SIMPLE
me.html) Thanks!
TRANSPOSITION
Rodriguez-Clark CIPHERS
(/SIMPLE-
TRANSPOSITION-
Legal All rights reserved
CIPHERS.HTML)

(/legal.html)
POLYALPHABETIC
Glossary
CRYPTO CORNER
SUBSTITUTION
CIPHERS
(/) (/POLYALPHABETIC-
(/glossary.html) SUBSTITUTION-
CIPHERS.HTML)
Help with
FRACTIONATING
Activities CIPHERS
(/FRACTIONATING-
(/help-with- CIPHERS.HTML)

activities.html) DIGRAPH
SUBSTITUTION
Educational CIPHERS
(/DIGRAPH-
SUBSTITUTION-
Uses CIPHERS.HTML)

(/educational-
GLOSSARY
uses.html) (/GLOSSARY.HTML)

Downloadble HELP WITH


ACTIVITIES
Resources (/HELP-WITH-
ACTIVITIES.HTML)
(/downloadable-
resources.html)

Das könnte Ihnen auch gefallen