Homework 1

advertisement
COMP 483/MATH 450 Homework 1
Part 1: Paper and Pencil: Due Friday, September 23, 2011
Part 2: Programming or Research: Due Monday, September 26, 2011
The following are paper-and-pencil problems. Except for possibly #2, please do not use a
computer when doing these problems. Calculators are okay. Show your work on all problems.
Part 1: Paper and Pencil
1. Problems 2.14, 2.15, 2.18, 2.20 from your textbook. In problem 2.14 (a), change the
message to be encrypted to be “meet at five” instead of the longer message given in the
text. If you aren’t familiar with matrix multiplication, please see me or go to the Math
ARC to figure it out.
2. Instructions for this problem: Make an attempt to break this cipher by hand. DO NOT
spend hours and hours of your time on it! Turn in work that shows a sincere effort. If
you do the optional programming problem, attempt to break the cipher with your
program.
The following text has been encoded using an affine cipher. Attempt to break the cipher
and find the encryption key. Show all your work, including guesses, errors, and dead
ends. (This includes a frequency table if you make one, or part of one.) You do not need
to finish deciphering the message if you are sure of your key. We will use the “a” = 01
for this affine cipher.
QBVDL WXTEQ GXOKT NGZJQ GKXST RQLYR XJYGJ NALRX OTQLS
LRKJQ FJYGJ NGXLK
QLYUZ GJSXQ GXSLQ XNQXL VXKOJ DVJNN BTKJZ BKPXU LYUNZ XLQXU
JYQGX NTYQG
XKXQJ KXULK QJNQN LQBYL OLKKX SJYQG XNGLU XRSBN XOFUL
YDSXU GJNSX DNVTY
RGXUG JNLEE SXLYU ESLYY XUQGX NSLTD GQXKB AVBKX JYYBR
XYQNQ GXKXZ LNYBS
LRPBA VLQXK JLSOB FNGLE EXYXU LSBYD XWXKF SJQQS XZGJS XQGXF
RLVXQ BMXXK
OTQKX VLJYX UQBZG JQXZL NG
Hint: to find the key, you may want to look at the ciphertext letters corresponding
to the plaintext letters that are early in the alphabet, such as a and e.
Part 2: Programming or Research
Choose either the Programming option OR the Research option. You do not need to do both!
Programming Option:
1. There are at least two ways in practice to decrypt a “3x + 2” affine cipher: table lookup
and subtract 2 and “divide” by 3 (mod 26). Give advantages and disadvantages of each
from an implementation point of view. Extend your answer to a general “ax + b” affine
cipher.
You may use any language or environment to write the programs in the next exercises. The user
interface is up to you. Turn in a hardcopy of the source code, and be prepared to run your
program for me. You may work in pairs. Rule with pairs – you may not program in the same
pair more than once!
2. Write a program that can encrypt and decrypt using an affine cipher. Decide whether you
want to use A=1 or A=0 for your cipher. (Include this decision in your program
documentation.) Input: a, b for encrypting by ax + b, and either the plaintext or
ciphertext. Output: Either the encrypted or decrypted message.
3. Write a program that can perform a letter frequency attack on a shift cipher without
human intervention. Your software should produce possible plaintexts in rough order of
likelihood. It would be good if your user interface allowed the user to specify “give me
the top 10 possible plaintexts”. You may choose to write this as a separate program from
the one in Part 1, or you may make it a decryption option through your user interface in
Part 1. Input: Ciphertext, and # of possible plaintexts user wishes to see. Output: The #
of possible plaintexts specified by user.
4. (Optional Challenge) Modify the program from Exercise 3 to work on an affine cipher.
Research Option:
1. Search for proper English words that can be obtained from one another using a shift
cipher. Try for a while yourself, and then see what you can find online. Give an example
of two such words, and the cipher(s) you used. Do these ciphers have any interesting
properties? Explain. Please cite any texts or online sources you use.
2. Look up what affine geometry is and explain why affine ciphers are called affine.
3. Prove the following statements:
a) If a, b, c and m are integers such that m > 0, d = gcd(c,m), and ac  bc(mod m) , then
a  b(mod m / d ) .
b) If a, b, c and m are integers such that m > 0, gcd(c,m) = 1, and ac  bc(mod m) , then
a  b(mod m) .
c) If a, b, k and m are integers such that m > 0, k > 0 and a  b(mod m) , then
a k  b k (mod m) .
Download