Answer To: COMP2300/COMP6300 Applied Cryptography Assignment 2 Total marks: 30 Weighting: 15% Deadline: Sunday...
Ria answered on May 27 2021
58696/carmicheal_number.gp
#Find Carmicheal number
#A Carmicheal number is an odd and composite number.
print1("Finding Carmicheal number.\nEnter a number: ");a = input();print("Following all numbers are Carmicheal numbers, for the number ",a);for (n = 1, 10^4 - 2, n += 2;if(gcd(a, n)==1, print1(n"\t")))
58696/Carmicheal_number.png
58696/dlp.gp
#Defining a function to calculate the value of x.
print("Given function,\nx*g congruent to h ( mod n )");print("Given values.\n g = 23, h = 25 and n = 1,200");print("Following all numbers are values of x which satisfies the function for g, h, n. ");function(n)={my(g=23,h=25,x=1);while((x*g - h)%n!=0,x += 1);print1(x"\t");};
for(n = 1,200,function(n))
58696/dlp.png
58696/inverse.gp
print("Finding multiplicative inverse of b modulo n.");print1("b = ");b = input();print1("n = ");n = input();b = b%n;for (i=1,n,if((b*i)%n == 1,print("Inverse of ",b," modulo ",n," is "i)))
58696/inverse.png
58696/Solution Paper.docx
Solution Paper
Question 1 (10 marks)
This question tests your knowledge of what constitutes a group. Let n be a composite number. Let X = {1,2,3,...,n - 1}.
(a) Let x belongs to X. Show that if there are integers a; b such that ax + bn = 1, then gcd(x; n) = 1. (2 marks)
(b) Let x belongs to X. Show that if gcd(x; n) 6= 1 then ax ≡ 1 (mod n) has no solution for any integer a. (2 marks)
(c) Show that there is at least one element x belongs to X, such that gcd(x; n) ≠ 1. (2 marks)
(d) Let be a multiplication modulo n. That is, for x, y belongs to X, x * y = xy (mod n). Prove that (X, *) is not a group. (2 marks)
(e) Let n = 13424. Let a = 13314 and let b = 5889. What are the multiplicative inverses of a and b modulo n? Show how you obtained the result. (2 marks)
Solution.
(a)
If we can prove that there exist a and b such that ax + bn = gcd(x, n) then it is proved.
Let S = { ax + bn | set of integers in this form } and d be the least positive element of S.
Then by division algorithm there exist q, r such that
x = qb + r , 0 ≤ r < d
⇒ r = x - qd
⇒ r = x - q(ax + bn)
⇒ r = (1 - qa)x - (qb)n
⇒ r belongs to S, r < d and d is the least element of the set S
⇒ r = 0 ⇒ d | x ⇒ d | n
⇒ d | gcd(x, n)
But gcd(x, n) | all elements of S ⇒ gcd(x, n) | d
⇒ gcd(x, n) = d
Therefore, d = ax + bn = 1
⇒ ax + bn = gcd(x, n)
⇒ gcd(x, n) = 1 when ax + bn = 1
Hence proved.
(b)
Since x belongs to X ⇒ x < n for x belongs to X
Since gcd(x,n) ≠ 1 ⇒ gcd(x, n) = d(let) > 1
Then there exist a, b such that
ax + bn = d
⇒ ax - d = bn (since n > 0, x > 0 and a, b can be any integer)
⇒ n | (ax -d)
⇒ ax ≡ d (mod n)
But d ≠ 1
Therefore, ax ≡ 1 (mod n) has no solution for any integer a. (Proved)
(c)
x belongs to the set X x < n for all x
Let gcd(x, n) = d > 1 (since gcd(x, n) ≠ 1 )
Then there exist a and b two integer such that ax + bn = d
ax + bn = d
⇒ ax - d = bn (since n > 0, x > 0 and a, b can be any integer)
⇒ n | (ax - d)
⇒ ax ≡ d (mod n)
Therefore, there exist at least one x belongs to X,
Such that gcd(x, n) ≠ 1
(Proved)
(d)
(X, *) is said to be form a group with respect to composition * ,if X satisfy all the following conditions closed, associative, identity property and inverse property under the given composition * .
i) For x belongs to X and y belongs to X
x * y = xy (mod n) belongs to (X, *)
Therefore, (X, *) closed under the composition * .
ii) For x,y and z belongs to X,
(x*y)*z = (xy)*z (mod n)
⇒(x*y)*z = xyz (mod n) belongs to (X, *)
x*(y*z) = x*(yz) (mod n)
⇒x*(y*z) = xyz (mod n) belongs to (X, *)
(x*y)*z = x*(y*z)
Therefore, (X, *) is associative under composition * .
iii) For x belongs to X and 1 belongs to X,
x*1 = x (mod n) that’s not possible since x belongs to X ⇒ x < n
Similarly, x*1 = x (mod n) not possible
Therefore, there is no identity element in X.
So, (X, *) is not a group.
(Proved)
(e)
If (Zn , *) form a group of integers under multiplicative composition *, every element of the group has to be co-prime to n.
From the question,
N = 13424, a = 13314 and b = 5889 ,
But a is not coprime to given n, therefore a not belongs to Zn,there is no multiplicative...