Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

INSTITUTO POLITCNICO NACIONAL

ESCUELA SUPERIOR DE CMPUTO

Cryptography
Session 4: Known plaintext attack September 7, 2017

In this session we will do a known plaintext attack to Hill cipher. Please work in teams of 2
students to develop the following programming exercises.

1. Hill cipher

To implement Hill Cipher consider the alphabet of all printable characters in ASCII. You can
use your favorite programming language.

1. Design a function that generates at random a valid key K, where K is a 2 2 matrix where
ki,j Zn and K has an inverse. Only K must be stored in a file. The user must give the
filename.

2. Design a function to encrypt using Hill cipher. The user must give to you, the filename of
the plaintext, the filename of the key and the filename to store the ciphertext. The size of
the plaintext must be at least 10kb.

3. Design a function to decrypt using the Hill cipher. The user must give to you, the filename
of the ciphertext, the filename of the key and the filename to store the plaintext. In this
case you must have a function to compute K 1 .

2. Known-plaintext attack

1. Design a program that receives pairs of plaintext and its corresponding ciphertext, your
program must find the key. Consider that Hill cipher was used as an encryption method.
3. Products

On September 19th (Tuesday) you must present a hard copy of your report. Your
report must contain at least:

1. Your personal information, date of the lab session and the topic that we are studying in
this lab session.

2. Give your own example to explain when a key is valid, how to encrypt and how to decrypt.
Please avoid to copy and paste an example from internet.

3. Give your own example to explain how did you make the known-plaintext attack. Please
avoid to copy and paste an example from internet.

4. Only the most important functions of your source code, explaining what they do.

5. If you did not conclude something, point it out and explain why you could not do it.

6. If you use some reference, please include it at the end of your report, using the IEEE
format.

You might also like