You are on page 1of 10

Institute of Engineering and Technology

Devi Ahilya Vishwavidyalaya, Indore (M.P.)

Cryptography and network security

Bachelor of Engineering

Electronics and Telecommunication Session 2018-19

Assignment On unit-3

Submitted To: Submitted By:

Dr. Uma Bhatt Deepanshu Demla


(DE15279)
Q. What do you mean by Euclid Algorithm?

The Euclidean algorithm is an efficient method to compute


the greatest common divisor (gcd) of two integers.

We write gcd (a, b) = d to mean that d is the largest number that


will divide both a and b.

If gcd (a, b) = 1 then we say that a and b are coprime or relatively


prime. The gcd is sometimes called the highest common
factor (hcf).

INPUT: Two non-negative integers a and b with a ≥ b.


OUTPUT: gcd(a, b).

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.

Q. Define Euler Phi Function?

In number theory, Euler's totient function counts the positive integers up to a


given integer n that are relatively prime to n. It is written using the Greek
letter phi as φ(n) or ϕ(n), and may also be called Euler's phi function. It can be
defined more formally as the number of integers k in the range 1 ≤ k ≤ n for which
the greatest common divisor gcd (n, k) is equal to 1. The integers k of this form are
sometimes referred to as totatives of n.

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.

Euler's totient function is a multiplicative function, meaning that if two


numbers m and n are relatively prime, then φ(mn) = φ(m)φ(n). This function gives
the order of the multiplicative group of integers modulo n (the group of units of
the ring Z/nZ). It also plays a key role in the definition of the RSA encryption
system.

Q. Define RSA cryptosystem and Explain


where it is Used?

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)

The special case where n is prime is known as Fermat's little theorem.

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.

Q. Explain and proof Fermat’s little theorem?


Give Examples.

Fermat's little theorem is a fundamental theorem in elementary number theory,


which helps compute powers of integers modulo prime numbers. It is a special
case of Euler's theorem, and is important in applications of elementary number
theory, including primality testing and public-key cryptography.

Fermat’s theorem states the following: If is prime and is a positive integer not
divisible by, then

a^p-1 = 1(modp)

Examples:

P = an integer Prime number

a = an integer which is not multiple of P

Let a = 2 and P = 17

According to Fermat's little theorem

2 17 - 1 ≡ 1 mod(17)

we got 65536 % 17 ≡ 1

that mean (65536-1) is an multiple of 17

Proof of Fermat’s little theorem:

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

set X = {a mod p, 2a mod p,…, (p-1)a mod p}

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 * 2a *…* (p-1)a ≡ [1 * 2 * 3 *…* (p-1)] (mod p) a p −1 ( p −1)! ≡ ( p −1)!(mod p )


Thus on equating (p-1)! Term from both the sides, since it is relatively prime to p,
result becomes,

a^p −1 ≡1 (mod p)

An alternative form of Fermat’s Theorem is given as

a^p ≡ a (mod p)

Q. Why is the need of polynomial Arithmetic and also explain


its classes?
Defining finite fields over sets of polynomials will allow us to create a finite set of
numbers that are particularly appropriate for digital computation. Since these
numbers will constitute a finite field, we will be able to carry out all arithmetic
operations on them — in particular the operation of division — without error.

We are concerned with polynomials in a single variable x, and we can distinguish


three classes of polynomial arithmetic.

•Ordinary polynomial arithmetic, using the basic rules of algebra.

•Polynomial arithmetic in which the arithmetic on the coefficients is


performed modulo p ; that is, the coefficients are in GF(p).

Ordinary Polynomial Arithmetic


A polynomial of degree n is an expression of the form

Where the ai are elements of some designated set of numbers S, called


the coefficient set, and an 0. We say that such polynomials are defined over the
coefficient set A zeroth-degree polynomial is called a constant polynomial and is
simply an element of the set of coefficients. An nth-degree polynomial is said to
be a monic polynomial if an = 1.

Polynomial arithmetic includes the operations of addition, subtraction, and


multiplication. These operations are defined in a natural way as though the
variable x was an element of S. Division is similarly defined, but requires that S be
a field.

Addition and subtraction are performed by adding or subtracting corresponding


coefficients. Thus, if

then addition is defined as

and multiplication is defined as

Where

Ck = a0bk1 + a1bk1 + ... + ak1b1 + akb0

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.

Polynomial Arithmetic with Coefficients in Zp


Let us now consider polynomials in which the coefficients are elements of some
field F. We refer to this as a polynomial over the field F. In that case, it is easy to
show that the set of such polynomials is a ring, referred to as a polynomial ring.
That is, if we consider each distinct polynomial to be an element of the set, then
that set is a ring.

When polynomial arithmetic is performed on polynomials over a field,


then division is possible.

–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

5/3 = (5 * 3-1)mod7 = (5 * 5)mod7 = 4

•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:

5/3 = 1 + 2/3 5=1*3+2

•Thus, division is not exact over the set of integers.

•Now, if we attempt to perform polynomial division over a coefficient set that is


not a field, we find that division is not always defined.

•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

f(x) = q(x)g(x) + r(x)

•With the understanding that remainders are allowed, we can say that polynomial
division is possible if the coefficient set is a field.

You might also like