Docsity

Midterm Exam Solution, Affine Cipher - Codes and Cryptography | MCS 425, Exams of Cryptography and System Security

Toggle sidebar
bg1
MCS 425 Midterm Exam Solutions —Spring 2008
1. [4 points] An affine cipher E,
(x) = x+(mod 26) encrypts plaintext
er
as
ciphertext
J
*, where *represents some ciphertext letter. Note the 26 letters correspond to
the integers {0,1,...,25} as follows:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
abcdefghijklmnopqrstuvwxyz
a) [3 points] What is *, i.e., what is the encryption of
r
?
From E
,
(
e
) =
J
and E
,
(
r
) = *,we obtain
4+9 (mod 26),
17+
*(mod 26).
Subtracting the first equation from the second gives
13
*9 (mod 26).
Since gcd(,26) = 1, must be odd, i.e., 1 (mod 2). It follows that
1313 (mod 26). Then *9 + 139 + 13 22. Thus
r
is encrypted
to
W
.
b) [1 points] Could the cipher described above encrypt
b
as
C
? Why or why not?
Yes, it could. To see this, we have to show that the simultaneous equations
4+ 9 (mod 26),
17+22 (mod 26),
+ 2 (mod 26),
have a solution.
The second equation follows from the first, so we can ignore it. Subtracting
the third equation from the first gives
3 7 (mod 26).
Thus 3
179763 11 (mod 26). From the third equation,
2211 917 (mod 26).
Thus there is a solution, 11 (mod 26) and 17 (mod 26).
pf3

Partial preview of the text

Download Midterm Exam Solution, Affine Cipher - Codes and Cryptography | MCS 425 and more Exams Cryptography and System Security in PDF only on Docsity!

MCS 425 Midterm Exam Solutions — Spring 2008

1. [ 4 points] An affine cipher E ,

( x ) =  x + (mod 26) encrypts plaintext er as

ciphertext J

, where

represents some ciphertext letter. Note the 26 letters correspond to

the integers {0,1,...,25} as follows:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

a b c d e f g h i j k l m n o p q r s t u v w x y z

a) [3 points] What is

, i.e., what is the encryption of r?

From E

 ,

( e ) = J and E

 ,

( r ) =


,

we obtain

4 +  9 (mod 26),

(mod 26).

Subtracting the first equation from the second gives

9 (mod 26).

Since gcd (,26) = 1, must be odd, i.e., 1 (mod 2). It follows that

13 13 (mod 26). Then


9 + 139 + 13 22. Thus r is encrypted

to W.

b) [ 1 points] Could the cipher described above encrypt b as C? Why or why not?

Yes, it could. To see this, we have to show that the simultaneous equations

4 +  9 (mod 26),

17 +  22 (mod 26),

+  2 (mod 26),

have a solution.

The second equation follows from the first, so we can ignore it. Subtracting

the third equation from the first gives

3   7 (mod 26).

Thus  3

 1

7  9 7  63 11 (mod 26). From the third equation,

 2  2  11  9 17 (mod 26).

Thus there is a solution, 11 (mod 26) and 17 (mod 26).

2. [5 points] Use the fact that

2

2

(mod 36503)

to produce a nontrivial factorization of 36503. Show your work, and use only methods

applicable even with very large integers.

Note 903

/ 481 (mod 36503), so by a major theorem proven in class,

36503 = gcd ( 36503, 90 3  481 )  gcd ( 36503, 903+481)

provided that one (and hence both) of 481 and 903 are relatively prime to

gcd ( 36503, 90 3 481) = gcd ( 36503, 422) is computed as follows:

So gcd ( 36503, 422) = 2 1 1. 36503 / 21 1 = 173, so 36503 = 21 1  173.

3. [ 6 points] In this problem, show all your work, and use only techniques that can be

used even with very large integers.

a) [ 2 points] Show that one of 3 or 5 is a quadratic residue mod 23, and the other is a

nonresidue.

(2 3  1 ) / 2 = 11. a is a quadratic residue mod 23 if and only if a

11

1 (mod 23).

3

2

9 (mod 23)

3

2

2

 9

2

 81 12 (mod 23)

3

2

3

 12

2

 144 6 (mod 23)

3

11

 3

2

3

 3

2

 3  6  9  3  162 1 (mod 23)

So 3 is a quadratic residue mod 23.

5

2

 25 2 (mod 23)

5

2

2

 2

2

4 (mod 23)

5

2

3

 4

2

16 (mod 23)

5

11

 5

2

3

 5

2

 5  16  2  5  160 1 (mod 23)

So 5 is a non-residue mod 23.

b) [ 2 points] Compute the square roots of 3 or 5 (the one that is a residue) mod 23.

Since 23 3 (mod 4), and since we know that 3 is a quadratic residue mod

23, the square roots of 3 mod 23 must be  3

(23+1)/ 4

6

. Using the values

of 3

2

and 3

2

2

above, we compute 3

6

2

2

2

 12  9  108 16 (mod 23).

So the square roots of 3 mod 23 are  16. (They may also be written as  7 .)

c) [ 2 points] Using only your result in part (a), and without performing any more

computation, decide whether 15 is a quadratic residue mod 23.

We know that ( residue )  ( non-residue ) = ( non-residue ). Since 3 is a residue

mod 23 and 5 is a non-residue, 15 is a non-residue mod 23.