This action might not be possible to undo. Are you sure you want to continue?

**1. Prove that a-I Solution: Firstly, 'we will prove if gcd(a, n) = 1, a-1 If gcd(a, n)
**

=

mod n exists if and only if gcd(a, n)

= 1.

mod

11,

exists.

= l.

**1, we can find x, y such that ax
**

a-I

+ ny

Then x

= a-I

mod

11,

Secondly, we will prove if

mod

11,

exists, gcd(a, n) = 1.

=

Let x be the inverse of a, i.e., ax = 1 mod n. Then xa Then dl(xa - qn). Obviously d = 1 since tea - qn = 1.

1+qn for some integer q. Let gcd(a, n)

=

d.

Q]

**2. Find the smallest positive integer x such that x . 4321 = 1 mod
**

Solution: x . 4321

=

x . 307

=1

2007. mod 2007:

mod

**2007. Let's calculate -6 1 10
**

-1

307-1 307 ) 2007 165 307

( )=(

165 307

).( ).(

( )=( ( )=( (

142 165 23 142

4

1 10

-1 1 10

23

)=(

-6 1 10

(!

Let's calculate

( Xl

X3

)=(

-5 1

10

) ).( ) ).( ) ).( )

142 165 23 142 4 23

-1 1

X2)

X4

= (.

-1 1). (-5 1). (-6 1). (-1 1). (

10 10 10 10

we find the value of the matrices product:

Xl

X3

10

)(

.

-~

After some computing,

(

X2)

X4

=(

523 -438

-80) 67.

Then

( ~) =

**(~~;8 ~~O).( 2~~~ )
**

307-1 = 523 mod 2007.

So 523·307 - 80 . 2007 = 1. That is, x

=

7 mod 13 = 3. 7 mod 13 = 9. 2B 727mod 13 = 3.3 .3 mod 13 = 9 7 mod 13 = 9.27 mod13 = = 27 .3 mod 13 = 9 727 mod 13 = 726.27 mod 13 . 7 mod 13 = 7 .3.What is the value of 72012 mod 13? Solution: Let x = 721J12 mod 13 2012 can be represented 2012 = [11111011100b_ in binary format as So. 726mod 13 = 9.3.3 mod 13 = 9 2B 7 mod 13 = 7 .27...3 mod 13 = 9 Therefore 210 7 729 728 Hence 7"27 726 724 723722 = mod13 9. 72[)12: can be written as 7 mod 13 = 2401 mod 13 = 9 7 mod 13 = 7 7 mod 13 = 7 7 mod 13 = 7 26 25 24 23 22 .9 mod 13 = 3 25 24 23 22 23 24 25 .81mod13.728 mod 13 = 3. mod l3 9 27 mod 13 . 22 7 mod 13 = 9.27 =3 mod 13 72012 mod 13 =3 . .9..9.9 mod 13 = 3 721lmod 13 = 29 727.9 mod 13 = 3 7 mod 13 = 3..9 mod 13 = 3 72"10 mod 13 = 728.9.81.

1) . Suppose that n. q = 4. In order to solve the system it must be brought under the format: X { = 4al x = 5a2 mod 99 mod 101 Since gcd(13. . Let's calcula.q with p . . Find Solution: ». 13-1 These two inverses will be calculated using the same method as in the previous exercise.382. Accordingly.382.lculate -1 1~ )( ) . 3019 and 1453. Suppose also that n 4.4. =p .386. (q . Find the smallest integer x 5 simultaneously. x = 4 mod 99 and 7 .607 and ¢(n) q.386. > 0 such that 13 . q different primes. 607 (p . ( ~ ) ( ~ ) = (-~ ~).· 1) ~). we get the equations: { p .136. x = 5 mod 101 are satisfied Solution: The exercise demands the resolution of an equation system. 4.te 13-1 mod 99: 8) ( 13 = (-71 0. 101) a1 = = 1 the values of al and a2 can be easily calculated as mod 99.136 After solve the equations. we get one pair of integer solutions. ( ~ ) Let's ca. 99) = 1 and gcd(7. -7 1 ~ After calculus we find the value of the matrices product: -38 5 -3 23 ) .1) = 4. That is. (13) 99 ( ~) (-i ~) (1~) ( ~ ) = (-~ ( : ) ( ~ ) = (-~ ~).

(N )-1 n1 mod n1 = 101-1 mod 99 = T1 mod 99 = Let's calculate 99-1 mod 101: ( ~) ( -49 1 .We find the value of Let's calculate 71 Xl = -38 ===} 13-1 mod 99 = -38 mod 99 = 61.61 5..)-1 mod n.. The CRT states that : If we have a system under the form X = a1 x = a2 mod mod n1 n2 { x = a I. i=l where N = rr~=1 ni and Gi = (. = \'Ve can use CRT to solve the system. X { = 46 x =44 mod 99 mod 101 \'Ve can find the solution of this system by applying the Chinese Reminder Theorem (CRT). mod 101: ( ~) ( -2 Let's calculate now: ( Xl X3 X2 X4 1 )( -14 1 ~ )( -2 1 1 0 )( 29 -2 -14 1 ) \'Ve find the value of Xl = 7-1 mod 101 = 29.nj) = 1 then the smallest integer that satisfies the given system is X= [t ai ' ~ ' 'Gil mod N. From the system we can calculate N Cl = 99 ' 101 50 = 9999. mod 99 and the second equatior After multiplying the first equation in the given system with 13-1 with 7-1 mod 101 the system will be the following: X { = a: = 4. And Vi.29 mod 99 mod 101 That is.j if j gcd(ni.

if p is prime» 2.P3 = ±1 Now based on this proof let's prove that for n has 23 = 8 solutions. Since n is prime it has no dividers of 0 in Zn and since x E Zn the equation is equivalent to (x . P2 and P3 are prime numbers larger than 2. . n] satisfying X2 = 1 mod n. We will first prove that the equation has exactly 2 solutions if n is prime. prove that there are exactly 8 integers X E [1. = 1 mod n for n » 2 prime has exactly 2 solutions x = PI .1 = 1 mod n and this is true only for n = 2 but n» 2. Thus. we have proven that if n.Let's calculate now: ( Xl X3 X2) X4 (-49 1 = 0 1) ( -1 1 ~) ( = 50 -1 Vvefind the value of Xl So X= I = 99-1 mod 101 50.n] integer.:. . For n » 2 x-I and x + 1 cannot be simultaneously O. Obviously.P2 . where PI. Let's prove that x is a solution of the equation x2 = 1 mod n if and only if x is the corespondent through CRT of the vector that is the solution of the following equation system: mod PI mod P'2 mod P3 . For n prime and >2 the equation can be written as: X2 - 1 = 0 mod n ===} (x + 1) . where Pt is a prime number E » 2 the equation The Chinese reminder Theorem (CRT) states that for each x between x and a vector: Zn there is a ont-to-one mapping where Xi =X mod Pi.1) = 0 mod n. Q] Given an integer n = PI 'P2 'P3. a . c"] x = [46·101 mod N accordingly to the CRT ·50 + 44·99· SO] mod 9999 4050100 mod 9999 = 1405.1 = 0) V (x + 1 = 0) mod n. (x . is prime and x2 . Solution: In order to prove that the equation X2 = 1 mod n (1) has exactly 8 solutions for x E [1. b = 0 mod P implies that a = 0 mod P or b = 0 mod p. So the solution of the given equation system is 1645 and it is the smallest positive integer accordingly to the CRT. So we have proven that the equation x2 mod n.1 = 0 mod n then x-I = 0 mod n or x + 1 = 0 mod n. ["L:~= ai . If not x-I = x +1 mod n ===} -1 = 1 mod n ===} n .

= 1 mod Pi ====} Xl = 1 mod Pi. So -wehave proven the direct implication. PI .ion: From the hypothesis we can extract that But and also CRT(l) = ( 1~) Since the CRT is a one to one mapping X So the following equality is satisfied: CRT(x2) the relation is equivalent to x2 = 1 mod n. The number of solutions in the [1. Let's apply mod Pi on each member ====} x2 mod Pi = (1 + q . n with q an integer. Let integer P be an odd prime number and P does not divide b. So the equation x2 = 1 mod PIP2PS has exactly 8 solutions in Zn. Since the equations of the 2 system are independent the number of solutions of the system will be the number of possible combinations of the solutions of each equation i. mod ps (2) Like proven before each equation of the system 2 has exactly 2 solutions. So by proving the double implication we have proven that: if CRT(x) is a solution of: = is a solution of x2 = 1 mod n if and only ( X:~1 ) mod PI rnod p-. Ps) mod Pi ====} (x mod Pi)2 mod Pi = 1 mod Pi ====} xf mod P. P2 . n] interval will also be exactly 8 because n = 0 mod n. 23 = 8. The inverse irnplicat.Let's consider the function CRT(x) = ( X::1 ) From the Chinese Reminder Theorem's properties we can extract the following property: If CRT(a) and CRT(b) then = ( a::l ) = ) ( b~~I CRT(a· b) =( :~ : ~~) ag and so CRT(x 2 ) =( :~ ) ·bs x~ Let x E Zn so that x2 = 1 mod n ====} x2 = 1 + q .e. Q] 7. = CRT(l). Then prove the following statements 5 .

= 1 mod p {==: =} (a2f. g(''''+l~'{P-l) = gk{p-l) gP. (b) (5 points) If p = 3 mod 4. is a cyclic group of order p .' = 1 mod p =} 9 m(~-l) = 1 mod p. two integers in [1.= 1 mod p. .1 and let's consider 9 one of it's generators. The only case when 1 = -1 mod p is for p = 2 (proven before) but p is odd. Since 9 is a group generator.' = 1 mod p and using the relation b = a2 mod p =} b". . and X2 = P . = b¥ -1 mod p. b-2.IJ 8. So b is a quadratic residue. W~ehave proven before that the equation x2 = 1 mod p has 2 solut.1 and this is only possible if x is even. So we . So both implications are proven and this means that the equivalence is proven: b is a quadratic residue . . Let's calculate & P.= 1 mod par g-2.= -1 p-l p-l . aP-1 mod p.Xl are the only two solutions. If b IS a quadratic residue. . .e.= -1 mod p. = g'" Since 9 is a group generator there exists an integer x so that b mod p . for p prime and different that 2. the exponent x(P2-1) must be a multiple of p . If tc is even. p-l of p If and only If b-2. This means that there is an integer k so that x = 2· k + 1.' (b) & is a quadratic non-residue of p if and only if Solution: Let's prove the first statement: a) b is a quadratic residue of p if and only if b Direct implication ===} P . Inverse implication {== . .= 1 mod p.p-1])for . mod p and so b-2- p-l = g--2- ::I:-(p-t) But &1'. then Xl equation a = x2 mod p.' . .. So we can apply Fermat's Theorem for a and prime p.')2 = 1 mod p.aternents (a) (5 points) There are only two solutions (i.' = p . = 1 mod p.• p-f p-l p-l can conclude that g-2. p-l g-2.(a) b is a quadratic residue of p if and only if b".. For the same reason like before the set Z. mod p. Because b is a quadratic non-residue x must be odd. Xo =} b = g'" = (g'"o) 2 mod p. If & is a quadratic residue of p then it exists an integer a so that b = a2 mod p. Since the order of 9 is p . there exists an integer x so that b = s" mod p. is a cyclic group of order p ." = g"..' mod p. But b1'. If we consider tc = g".' = -1 =} 1 = -1 mod p contradiction with p prime odd. the set Z.. p will not divide a2 and so p will not divide a. Let's prove the second statement: b) & is a quadratic non-residue of p if and only if b1'.= -1 mod p and ao based on the relation.' = 1 Inverse implication Since p is prime.. p-l Let's suppose that b is a quadratic residue.1. This question is about solving the quadratic congruence.. we have proven that b-. Since p does not divide b. Assume that p > 2 is a prime number and the positive integer a = x2 mod p for some unknown integer x E [l. [. So b is not a quadratic residue so it must be a quadratic non-residue..' mod b1'. = aPt' 6 mod p. we can deduce that . a: = 2 . The direct implication is so proven. Prove the following st.' Direct implication ===} = -1 mod p. b-2.p -1].ions x = ±1. The first solution is false because the order at g ISp-1. 1'-21 So we found out that b = g-2- p-l mod p But gP-l = 1 mod p =} (g".' = 1 mod p. Let's consider g. .= g-'-' mod p.1. one of it's generators.

there is no integer t such that t2 = 2 mod p if p = 5 mod 8. let's compute xf 2a· (4a) "g5 xi (2a· (4a)~)2 (4a 2.-1 a mod p (a- p-l 2- mod P = 1) is a solution and p - Xl is the other solution. P . 0 < Xl < p . Let Xl = a-"¥ mod p 2 Xl (aPt')2 a-4a-4-·a a .Xl must also be a root because P . then only two solutions.e. .' . a"..p -1]. p . which is satisfied with a = x2 mod p.1 and "1'.. a = x~ = mod p. ) . is one of the roots. . we only need to show that Xl = a"tl mod p is a solution. (4a)-4P . that is. and "gO X2 = P .. we have p-t a-2mod p = 1) a xg x5 a Notice that since p = 3 mod 4.Xl are different. and X2 = P-XI Hint: (1) notice that a ".' = 1 mod Pi (2) notice that 2 is a quadratic non-residue modulo p.(c) ( 5 pomts If p = 5 mod 8 and a-4." p-5 4":. This.5 are indeed integers. then are the only two solutions. Assume Xl. i. we know is a quadratic-residue. Moreover. mod p "1'::. Assume X2 is another root. . we know that there exits some integer.Xl are the all roots. So we conclude that there are at least two different roots. If we can prove Xl and p . Then we know a= mod p. So. We then evaluate them one by one all follows. mod p mod p mod p mod p . p-l = 1 mod p.:' . .-1 Xl = a-8- .. we get Xl = P . Xl = 2a· (4a) mod p.Xl carr be written as -Xl. Let's compute modp mod p • xf mod p xf (a t")2 .= 1 mod p. Xl and p - Xl are are the only two solutions for equation a = x2 (b) (5 points) From the above prove. "1'11 P is indeed an integer.Xl are the (d) (5 points) If p = 5 mod 8 and a ". Thus we get xi xf (X2 =} =} - Xt)(X2 Xl = Xl + Xl) = 0 mod p or X2 0 mod p X2 X2 X2 mod p or + Xl = =0 P- mod p Xl = = -Xl mod p mod p. s E [l.1]. "I'~l (c) (5 points) Notice that since p = 5 mod 8. Obviously.+" a2- a-2a So Xl . It contradicts p is prime and p > 2. a a • a 7 .. and let's compute mod p xf and "1'13 are indeed integers.+3 mod p. we are done. (a) According to the assumption in the question. Solution: To solve this problem. Notice that since = mod p for some unknown integer E [1.. we basically need to substitute the numbers given in the question to see if x2 = a mod p.Xl =} P = 2· Xl.-1 p+2 mod p mod p modp (a- p-1 4- mod p = 1) So Xl is a solution and p that Xl = Xl is the other solution.Xl are equal. these two roots Xl and p . a 2". (3) an integer b is a quadratic residue modulo p Iff b-'." = -1 mod p. (d) (5 points)Notice mod p where since p = 5 mod 8. if p = 5 mod 8." . If Xl and P .

. Solution: The solution of this problem is omitted. 10.1. and n = 2345 + 1. 256 = 32768.k2 mod 256 so in order for the encryption function to be a valid one. 1 So lor the key k2. X + k2.Xl is the other solution. contains the integers that are co-prime with 256. 8 .P The last equation is true since a:'"41 = -1 and 2 is non-quadratic residue (which implies that 2 . = g] 9. An affine cipher encrypts a plaintext X E [0. A key (kl. So the number of elements in Z. there are 256 values possible : 0 ---t 255. X = Y . So the total number of possible keys is 128 . So your code should be able to take care of big integers.k2) with o < kl' k2 < 255 is valid for an affine cipher if the function kl x + k2 mod 256 is an one-to-one mapping. and n > O. Here the input integers could be up to 1000 bits. In order to have a one-to-one mapping the encryption function must be invertible. So Xl is a solution and p . the value of kl must be invertible modulo 256. So kl can take 128 valid values.. is 128. The only valid values of kl are the elements of Z~.255] that are odd are co-prime with 256 because 2 is the only divider of 256. How many different valid keys for this affine cipher? Solution: In order to find the number of possible keys we must determine the number of keys that permit a one-to-one mapping of a plain text x to it's cypher text y = kl . Since 256 = 28. when a = 2123 - 1.. all the numbers from [0. b > 0. Use your code to find what is the last digit of the following number b = 2999 . aD mod n. The set Z.255] as y = klx + k2 mod 256. Departing from the encryption function y = kl . when given integer a> 0. X + k2 mod 256 =} kl . Write a code to compute aD mod n.' -1).

Sign up to vote on this title

UsefulNot usefulAre you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.