Unit-3 Cryptography Assignment
Unit-3 Cryptography Assignment
Bachelor of Engineering
Assignment On unit-3
While b > 0, do
Set r = a mod b,
a = b,
b=r
Return a.
The proof uses the division algorithm which states that for any
two integers a and b with b > 0 there is a unique pair of
integers q and r such that a = qb + r and 0 <= r < b.
Essentially, a gets smaller with each step, and so, being a positive
integer, it must eventually converge to a solution (i.e. it cannot
get smaller than 1).
If you have negative values for a or b, just use the absolute
values |a| and |b| in the above algorithm. By convention, if b =
0 then the gcd is a.
For example, the totatives of n = 9 are the six numbers 1, 2, 4, 5, 7 and 8. They are
all relatively prime to 9, but the other three numbers in this range, 3, 6, and 9 are
not, because gcd(9, 3) = gcd(9, 6) = 3 and gcd(9, 9) = 9. Therefore, φ(9) = 6. As
another example, φ(1) = 1since for n = 1 the only integer in the range from 1
to n is 1 itself, and gcd(1, 1) = 1.
RSA, named after its founders Rivest, Shamir and Adleman, is the most widely
used public key cryptosystem. The idea behind public key cryptography is that a
publicly available key is used to encrypt a message (called ’plain text’). The
encrypted plain text is known as ’cipher text’ and can be sent to an intended
receiver without need for a secure connection. The cipher text cannot then be
decrypted unless a private key is known; this is not published to the general
public.
Exactly what the public and private keys are however is where Euler’s theorem
comes in. The strength of RSA is in the difficulty of factoring very large numbers
into their prime decomposition. Calculating the product of two very large primes
is an easy task for a computer, but to find the initial primes when only the final
product is given is very demanding. The following is a summary of the RSA
algorithm
1. The receiver chooses secret primes p and q and computes n = pq.
2. They then choose e with gcd(e, ϕ(n)) = 1.
3. d is then computed with de ≡ 1 (mod ϕ(n)).
4. n and e are made public, whereas p, q, d are kept secret.
5. A sender encrypts their plain text m as c ≡ me (mod n) and sends c to the
receiver.
6. The receiver decrypts the cipher text c by computing m ≡ c d (mod n).
Whenever a small padlock appears next to the url in your internet browser RSA is
being implemented. SSL (secure sockets layer) certificates are used to validate a
website’s legitimacy and operate using RSA. When a computer connects to a
server with an SSL certificate what is known as an ’SSL handshake’ is performed
during which there is an exchange of messages which allow the server to
authenticate itself. RSA is used also for ’digital signatures’ which are attached to a
message or document and can be used to show that it was sent from a trusted
sender. Both SSL certificates and digital signatures are involved when a payment is
made online; RSA public key is there to help ensure that the transaction is secure.
Q. Explain Euler theorem?
The Euler theorem states that if a and n are relatively prime then
a^f(n) = 1(modn)
This follows from Lagrange's theorem and the fact that φ(n) is the order of
the multiplicative group of integers modulo n.
The RSA cryptosystem is based on this theorem: it implies that the inverse of the
function a ↦ ae mod n, where e is the (public) encryption exponent, is the
function b ↦ bd mod n, where d, the (private) decryption exponent, is
the multiplicative inverse of e modulo φ(n). The difficulty of
computing φ(n) without knowing the factorization of n is thus the difficulty of
computing d: this is known as the RSA problem which can be solved by
factoring n. The owner of the private key knows the factorization, since an RSA
private key is constructed by choosing n as the product of two (randomly chosen)
large primes p and q. Only n is publicly disclosed, and given the difficulty to factor
large numbers we have the guarantee that no-one else knows the factorization.
Fermat’s theorem states the following: If is prime and is a positive integer not
divisible by, then
a^p-1 = 1(modp)
Examples:
Let a = 2 and P = 17
2 17 - 1 ≡ 1 mod(17)
we got 65536 % 17 ≡ 1
Consider a set of positive integers less than ‘p’ : {1,2,3,…..,(p-1)} and multiply each
element by ‘a’ and ‘modulo p’ , to get the
No elements of X is zero and equal, since p doesn’t divide a. Multiplying the
numbers in both sets (p and X) and taking the result mod p yields
a^p −1 ≡1 (mod p)
a^p ≡ a (mod p)
Where
In the last formula, we treat ai as zero for i > n and bi as zero for i > m. Note that
the degree of the product is equal to the sum of the degrees of the two
polynomials.
–Note that this does not mean that exact division is possible. Let us clear this
•Within a field, given two elements a and b, the quotient a/b is also an element of
the field.
•However, given a ring R that is not a field, in general, division will result in both a
quotient and a remainder; this is not exact division.
•Consider the division 5/3 within a set S. If S is the set of rational numbers, which
is a field, then the result is simply expressed as 5/3 and is an element of S. Now
suppose that S is the field Z7, then
•Finally, suppose that S is the set of integers, which is a ring but not a field. Then
5/3 produces a quotient of 1 and a remainder of 2:
•If the coefficient set is the integers, then (5x2)/(3x) does not have a solution,
because it would require a coefficient with a value of 5/3, which is not in
the coefficient set.
•Suppose that we perform the same polynomial division over Z7. Then we have
(5x2)/(3x) = 4x, which is a valid polynomial over Z7.
•Given polynomials f(x) of degree n and g(x) of degree (m), (n >= m), if we
divide f(x) by g(x), we get a quotient q(x) and a remainder r(x) that obey the
relationship
•With the understanding that remainders are allowed, we can say that polynomial
division is possible if the coefficient set is a field.