Week 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

[CS304] Introduction to Cryptography and Network Security

Course Instructor: Dr. Dibyendu Roy Winter 2023-2024


Scribed by: Shah Vedant Rupeshkumar (202151143) Lecture (Week 1)

1 Introduction
Cryptography is the method of encrypting the messages and Cryptanalysis is the method of
finding various ways to decode the message. Both Cryptography and Cryptanalysis combine to
form Cryptology which is a method to do secure communications.

The strength of the Cryptographic program depends on the measure of security of the en-
cryption process carried out. Cryptanalysis techniques are performed to claim the security of the
cryptographic program.

Exhaustive search is carried out by trying out all possible ways and decoding the original
message. For example, if there are 80 bits security claimed by the creator of the encryption algo-
rithm, then its complexity should be 280 . If the search is carried out in lesser amount of time, then
the system breaks as claimed security is not satisfied.

These standardization of all the algorithms and the measure of security is done by NIST which
is the organsization to standardize design and implementation of the cryptographic algorithms.

We will take the example of a basic cryptographic process of a ATM card PIN number. So for
example we have a PIN as a plaintext and we will choose a random number x which will act as a
secret key. So, the encryption process will be as follows:

P in + X = Y (1)
Here, y is the Cipher text or the encrypted text and the function( Plaintext + Secret key) is called
the encyption function).The decryption process will be as follows:

Y − X = P in (2)
So, the basic process can be written as follows:

Encrytion : E(P, k) = C (3)

Decryption : D(C, k) = P (4)


where C is the Cipher text and P is the plain text.

1
2 Types of cryptography:
Symmetric key Cryptography: Here, there is only one key i.e. the Private key which is used
for the encryption and decryption of the message.

Public/Asymmetric key Crypography: Here, we have 2 keys of which one is public key
and the other is private/secret key. The public key is used for the encryption of the messages and
the private key is used for decryption of messages.So, the only those can decrypt the message who
are aware of the private key.

3 Security features of Cryptography:


Confidentiality(Secrecy): It gives a surity that the message can be accessed only by intended
receiver. It also keeps check that the original data cannot be recovered without proper credentials,
even if the data transfer was through any insecure channel.

Integrity(Anti-Tempering): It ensures that information has not been tampered with or


modified in an unauthorized way.The message received by receiver is same as that sent by the
sender.

Authentication: It has the task to ensure that information and communication come from a
trusted source and to verify the sender/receiver’s identity.

Non-Repudiation: Its function is to ensure that a party cannot deny having sent or received
a message or transaction.

4 Caeser Cipher:
It does the work of converting the plain text into cipher text.It shifts every alphabet by three(3)
positions in the cyclic fashion and generates a cipher text. So, it basically converts the alphabet
range (A-Z) into numbers(0-25). For encryption, it adds 3 and then takes modulo by 26 in order
to get cipher text.For decryption,it subtracts 3 and then takes modulo by 26 in order to get plain-
text or the original message. Thus, it uses the additive inverse methodology to decrypt the message.

For example:
Plain Text: ”JAYSHREERAM”
Cipher Text: ”MDBVKUHHUDP”(Generated by shifting each character by 3)

5 Functions and its Types


A function is a mapping from A-¿B where A is the domain and B is the Co-domain and for all a
and b belonging to A and if a=b, then f(a)=f(b).

2
One-One Function:
One-One function is a function that maps unique elements of domain to unique elements of
codomain.

Onto Function:
For the above two sets A and B as mentioned in function’s defination, if for every element of B,
there exists atleast one or more element matching with set A, then it is called onto function.

Bijective Function:
A function which is both One-One and Onto is called bijective.

One Way Function:


One way functions are such functions for which we can easily compute the output from the inputs
available but the vice versa is difficult.For example, If we have x, the we can easily compute f(x)
but given y, it becomes difficult for us to calculate x’ which satisfies f(x’)=y.

6 Substitution Box:
It is defined as a condition where the co-domain of a function is smaller than the domain of the
function

S : A− > Bwith|B| <= |A| (5)


,where B is the co-domain set and A is the domain set of the function as mentioned above.

7 Transposition Cipher:
We define this cipher as the permutation of the original message. Here, we just rearrange the words
of the original message by the mapping available and if the receiver also has that mapping, then
only the message can be decoded.

Plain Text: Combination of m1,m2,m3 ... messages

M = m1 m2 m3 .....mt (6)

Secret Key: Any permutation of the ’t’ elements. Encryption:

c = me (1)me (2)me (3).....me (t) = c1 c2 c3 ....ct (7)

Decryption:

M = me−1 (1) , me−1 (2) , . . . , me−1 (t)

3
For example,
Plain Text = Vedant

 
V E D A N T
e = 1 2 3 4 5 6 .
4 5 2 1 3 6
Cipher text= ADNVET,
 
A D N V E T
d= 1 2 3 4
 5 6 .
4 3 5 1 2 6
Where e represents the encryption matrix and d represents the decryption matrix.

8 Substitution Cipher:
Let us consider the set of all english alphabets as A. So, a mapping from A set to the same set
is done in substitution cipher.The secret key is made by mapping the element of A to a element
of A.Opposite mapping is created for the decryption process. If there are multiple possibilities
involved for deryption part, then only the meaningful words are considered.

For example,
e(A) = R,
e(B) = A,
e(C) = M
ABC = Plain Text and it will be converted to RAM = Cipher Text

9 Affine Cipher:
The cipher converts the plain text into cipher text. Firstly, it maps the alphabet range (A-Z) into
numbers(0-25). Then, it takes a and b as parameters such that gcd of a and 26 is 1 and a and b
are coprimes.

Encrytion : C = (a.x + b)%(26) (8)

Decryption : D = ((C − b).a−1 )%26 (9)


Here, C represents the cipher text and D represents the decrypted text.a−1 represents the in-
verse of a. Here, the inverse is calculated using extended euclidean algorithm.

The extended Euclidean algorithm is an extension of the Euclidean algorithm for finding the
greatest common divisor (GCD) of two integers. In addition to computing the GCD, it also finds
integers x and y such that:

4
a.x + b.y = 1 (10)

a.a−1 = 1%26 (11)


Note that the decryption function will only work when the gcd of a and m is 1 as if it is not 1,
then it is not possible to calculate multiplicative inverse of a modulo 26.

Then by Euler Totient Function, if n = pq, then with p and q being co-prime, then Q(n)=(p-
1)(q-1). We have n=26, so we get p=13 and q=2, giving Q = 12, hence we can only select 12 values
in the case of Affine Cipher out of 26 alphabets.

10 Playfair Cipher:
In this cipher, we create a 5 x 5 matrix with all the distinct letters which appear in the secret key
and the rest are filled with the remaining letters from the alphabet series.Since there are only 25(5
x 5) letters available to fill this grid, we presume two letters will be the same (for example, I = J).

The process of converting the plaintext into cipher text includes splitting then into pairs of 2
and if the length is odd, then we add a dummy character X at last to make it even. When both the
letters appearing in the pair are same, then we will add a dummy character X at the end of both
the characters. For example, if the text is ”BALL” then LL appear in a pair. So, we convert the
text into ”BA LX LX” adding X at the end of each same character.Now, we can easily calculate
the results.

When both letters in a pair appear in the same row or column, we consider that column to be
circular and assign that letter to the next value of the row or column. Thereafter, we go through
each pair one at a time. We regard the two letters in a pair that are in separate rows and columns
to be the corners of an imaginary rectangle and create it around them. The letter at the top right is
interchangeable with the letter at the top left, and the letter at the bottom right is interchangeable
with the letter at the bottom left.

For example,
Secret key = jaishreeram EXAMPLE , (I=J considered)
 
I A S H R
E M B C D 
 
F G K L N 
 
O P Q T U 
V W X Y Z

Plain Text: VEDANT which is broken to ’VE’, ’DA’ and ’NT’.


Using the playfair Cipher, we get ’IFMRLU’ as the resulting cipher.

You might also like