0% found this document useful (0 votes)
185 views

Introduction To Mathematical Cryptography

- Cryptography involves hiding messages to maintain secrecy and prevent unauthorized access. It uses techniques like encryption to conceal messages from public view. - Simple ciphers include the Caesar cipher which shifts letters by a set number of positions in the alphabet. The Vigenère cipher uses a keyword to shift letters at different positions. - Modern cryptography relies heavily on mathematics and number theory concepts like modular arithmetic, greatest common divisors, and division with remainder. These concepts are important for algorithms like the Diffie-Hellman key exchange and RSA public key cryptography.

Uploaded by

Jyothi upadhyay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
185 views

Introduction To Mathematical Cryptography

- Cryptography involves hiding messages to maintain secrecy and prevent unauthorized access. It uses techniques like encryption to conceal messages from public view. - Simple ciphers include the Caesar cipher which shifts letters by a set number of positions in the alphabet. The Vigenère cipher uses a keyword to shift letters at different positions. - Modern cryptography relies heavily on mathematics and number theory concepts like modular arithmetic, greatest common divisors, and division with remainder. These concepts are important for algorithms like the Diffie-Hellman key exchange and RSA public key cryptography.

Uploaded by

Jyothi upadhyay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Ramaiah University of Applied Sciences

Mathematics and statistics Department

“Mathematical Cryptography”

◦Seminar by

1
JyothiUpadhyay
Content
● Introduction
● Simple ciphers
● Mathematics in Cryptography
● Modular Arithmetic and shift ciphers
● Types of cryptography
● Public key cryptography
● Diffie-Hellman Key exchange
● RSA Public key
● Digital signature
● Cryptography benefits and drawbacks
● References

2
Introduction
"The art of writing and solving codes"
Derived from greek word, cryptos means hidden and graphy means writing.

Internet provides essential communication between tens of millions of people and is being increasingly used as a tool
for commerce, security becomes a tremendously important issue to deal with.

There are many aspects to security and many applications, ranging from secure commerce and payments to private
communications and protecting passwords.

One essential aspect for secure communications is that of cryptography. But it is important to note that while
cryptography is necessary for secure communications, it is not by itself sufficient.

3
● Secure communication can be provided using techniques, in the presence of malicious third-party content called
adversaries. These techniques can be referred to as Cryptography.

● Any private messages can be hidden from the public or any third parties using a set of protocols. These protocols need
to be analyzed and constructed in an efficient manner in order to maintain the secrecy of message being sent.

● Modern Cryptography has a certain aspect that is central to it, like data integrity, authentication, confidentiality etc. In the
modern world, Cryptography heavily relies upon subjects like mathematics and computer science.

● Algorithms for Cryptography are designed in such a way that they are hard to crack in practice by any malicious third
party, also known as adversaries. A practical approach toward cracking such an algorithm would fail; however, the
theoretical approach may possibly crack such a system.

● Thus, any algorithm can be cited as secure if its key properties cannot be deduced with a given ciphertext. Cryptography
can be categorized into two branches: Symmetric and Asymmetric.

● Cryptography is the study of concepts like encryption, whereas encryption is a technique used to conceal messages using
algorithms.
4
Simple Ciphers

1. Caesar Cipher (or) Shift Ciphers


Let this be the message:
jsjrdkfqqnslgfhpgwjfpymwtzlmnrrnsjsyqzhnzx → Cipher
text (encrypted)
The trick is easy. Simply take each letter in the message and shift it five letters up the alphabet. Thus j in the
ciphertext becomes e in the plaintext, because e is followed in the alphabet by f,g,h,i,j. Applying this procedure to
the entire ciphertext yields
jsjrdkfqqnslgfhpgwjfpymwtzlmnrrnsjsyqzhnzx
enemyfallingbackbreakthroughimminentlucius
→plain text (decrypted)
The second line is the decrypted plaintext, and breaking it into words and supplying the appropriate punctuation
“Enemy falling back. Breakthrough imminent. Lucius”.

5
● In the above example we say that to encrypt
the message we used 5 letter substitution.
● Similarly to decrypt we count 5 letters
backward.
● And the “5 letter” rule is known as secret key.
● And to decrypt the message, secret key
should be known.
● But in case of this alphabetical ciphers, it's
easy to know the key just by performing some
substitutions of the letters.
● In order for decryption to work, the
encryption function must have the property
that no two plaintext letters go to the same
simple substitution cipher may be viewed as a rule or ciphertext letter. A function with this property
function is said to be one-to-one or injective.
{a,b,c,d,e,...,x,y,z} −→ {A,B,C,D,E,...,X,Y,Z}
6
2. Vigenère Cipher
Let the message be “YOU CAN TRUST ME”

Let the Key be “COMPUTER”

Y 0 U C A N T R U S T M E Plain text

C O M P U T E R C O M P U Key (add)

B D H S V H Y J X H G C Z Cipher text (encrypt)


“BDHSVHYJXHGCZ” is the encrypted message.

B D H S V H Y J X H G C Z Cipher text

C O M P U T E R C O M P U Key (subtract)

Y O U C A N T R U S T M E Plain text (decrypt)

7
Vigenère Cipher is similar to Caesar cipher. In this to encrypt the message we make use of a secret key and that secret key is a word.
To decrypt the message we make use of encrypted message and the secret key.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

A B C D E F G H I J K L M N O P Q R S T

21 22 23 24 25 26

U V W X Y Z

we see that, Y=25 (position) and C=3 (position)

Y+C=25+3=28 → 28☰2(26 letters alphabet)

I.e., 28-2=26(26 letters)

I.e., 28☰2(mod26) , which is basically modular addition.

{a☰b(modn) / n|(a-b)}

8
In order to cipher a text, take the
first letter of the message and the
first letter of the key, add their
value (letters have a value
depending on their
rank in the alphabet, starting with
0). The result of the addition
modulo 26 (26=the number of letter
in the alphabet) gives the rank of the
ciphered letter.
9
Cryptanalysis:
The process of decrypting a message without knowing the underlying key is called cryptanalysis. (substitution ciphers) While
cryptography is the science of securing data, cryptanalysis is the science of analyzing and breaking secure communication. Classical
cryptanalysis involves an interesting combination of analytical reasoning, application of mathematical tools, pattern finding, patience,
determination, and luck. Cryptanalysts are also called attackers.

Cryptology embraces both cryptography and cryptanalysis.

10
Mathematics in cryptography
● Much of modern cryptography is built on the foundations of algebra and number theory.
● Number Theory is the study of the natural numbers

1, 2, 3, 4, 5, 6, . . . ,

or slightly more generally, the study of the integers

. . . ,−5,−4,−3,−2,−1, 0, 1, 2, 3, 4, 5, . . . .

● Divisibility:
Let a and b be integers with b = 0. We say that b divides a, or that a is divisible by b, if there is
an integer c such that
a=bc

We write b | a to indicate that b divides a.

11
Greatest common divisor:
A common divisor of two integers a and b is a positive integer d that divides both of them. The
greatest common divisor of a and b is, the largest positive integer d such that d | a and d | b. The
greatest common divisor of a and b is denoted gcd(a, b). If there is no possibility of confusion, it is
also sometimes denoted by (a, b).

The key to an efficient algorithm for computing greatest common divisors is division with
remainder, which is simply the method of “long division” . Thus if a and b are positive integers
and if you attempt to divide a by b, you will get a quotient q and a remainder r, where the
remainder r is smaller than b.

Division With Remainder :


Let a and b be positive integers. Then we say that a divided by b has quotient q and remainder r if

a=b·q+r with 0 ≤ r < b.

The values of q and r are uniquely determined by a and b 12


The Euclidean algorithm

It is an efficient method for computing the greatest common divisor (GCD) of two integers (numbers), the largest number that
divides them both without a remainder. It is named after the ancient Greek mathematician Euclid.

It is an example of an algorithm, a step-by-step procedure for performing a calculation according to well-defined rules, and is
one of the oldest algorithms in common use.

It can be used to reduce fractions to their simplest form, and is a part of many other number-theoretic and cryptographic
calculations.

The Euclidean algorithm is based on the principle that the greatest common divisor of two numbers does not change if the
larger number is replaced by its difference with the smaller number.

If d is any common divisor of a and b, then it is clear that d is also a divisor of r. Similarly, if e is a common divisor of b and r,
then shows that e is a divisor of a. In other words, the common divisors of a and b are the same as the common divisors of b
and r; hence gcd(a, b) = gcd(b, r).

13
Ex: 2024/748, a=2024, b=748

2024 = 748 · 2 + 528 528 = a − 2b

748 = 528 · 1 + 220 , b = (a − 2b) · 1 + 220,

So, 220 = −a + 3b.

528 = 220 · 2 + 88 a − 2b = (−a + 3b) · 2 + 88,


so, 88 = 3a − 8b.

220 = 88 · 2 + 44 −a + 3b = (3a − 8b) · 2 + 44,


so, 44 = −7a + 19b.

88 = 44 · 2 + 0 −7 · 2024 + 19 · 748 = 44
gcd(2024, 748)=44

We found the GCD = 44 , using the division with


remainder method.

It is always possible to write gcd(a, b) as an integer


linear combination of a and b
14
Extended Euclidean algorithm
The extended Euclidean algorithm is an
extension to the Euclidean algorithm, in
addition to the greatest common divisor (gcd)
of integers a and b they are integers x and y
such that
ax+by=gcd(a,b)
It is used to write the gcd of two numbers a
and b in the form of linear combination of
two numbers and is used to find the values
of x and y by reverse substituting .
Extended euclidean algorithm starts at the
end of euclidean algorithm and moves
backwards.

15
● Let a and b be integers. We say that a and b are relatively prime if gcd(a, b) = 1.
● The Set Of Integers Modulo P: The set:

Zp={0,1,2,...,p−1

Is called the set of integers modulo p (or mod p for short). It is a

set that contains Integers from 0 up until p−1.

Example: Z10={0,1,2,3,4,5,6,7,8,9,10

Modular Arithmetic :
The theory of congruences is a powerful method in number theory that is based on the simple idea of
clock arithmetic. Definition. Let n ≥ 1 be an integer. We say that the integers a and b are congruent
modulo m if their difference a − b is divisible by n. Wewrite

a ≡ b (mod n)
16
to indicate that a and b are congruent modulo n. The number n is called the modulus.
Multiplicative inverse:
A multiplicative inverse for x is a number that when multiplied by x will equal to 1 (identity). The multiplicative inverse of x is written as
x-1
and is defined as x.x-1=1
Inverse only exists if the greatest common divisor is 1 i.e., gcd(x,p)=1

Prime Number :
A prime is a number that can only be divided without a remainder by itself and 1.
For any prime number p, every number from 1 up to p−1 has a gcd of 1 with p, and therefore has a multiplicative inverse in modulo p.

Euler’s totient function:


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) and may also be called Euler's phi function.
In other words, it is the number of integers k in the range 1 ≤ k ≤ n for which the greatest common divisor gcd(n, k) is equal to 1.

Calculating Euler’s phi function: ϕ(n)=ϕ(p⋅q)=ϕ(p)⋅ϕ(q)=(p−1)⋅(q−1)

17
Modular arithmetic with shift ciphers
Caesar (or shift) cipher works by shifting each letter in the alphabet a fixed number of letters. We can
describe a shift cipher mathematically by assigning a number to each letter.

Then a shift cipher with shift k takes a plaintext letter corresponding to the number p and assigns it
to the ciphertext letter corresponding to the number p + k mod 26.

The shift amount serves as both the encryption key and the decryption key. Encryption and
decryption is given by the formula

c ≡ p + k (mod 26) and p ≡ c − k (mod 26)

c - cipher text

p - plain text

k - secret key
18
A cryptographic algorithm, or cipher, is a mathematical function used in the encryption and decryption process.

A cryptographic algorithm works in combination with a key — a word, number, or phrase — to encrypt the plaintext.

The same plaintext encrypts to different ciphertext with different keys. The security of encrypted data is entirely dependent on
two things: the strength of the cryptographic algorithm and the secrecy of the key.

A cryptographic algorithm, plus all possible keys and all the protocols that make it work comprise a cryptosystem.
OpenPGP,RSA is a cryptosystem.

Cryptosystem:
A cryptosystem is a structure or scheme consisting of a set of algorithms that converts plaintext to ciphertext to encode or
decode messages securely. Cryptosystems are used for sending messages in a secure manner over the internet, such as credit
card information and other private data.

19
Keys
● A key is a value that works with a cryptographic algorithm to produce a specific ciphertext. Keys are basically really,
really, really big numbers. Key size is measured in bits; the number representing a 1024-bit key is really huge. In public
key cryptography, the bigger the key, the more secure the ciphertext.

● However, public key size and secret key size are totally unrelated. A private 80-bit key has the equivalent strength of a
1024-bit public key. A private 128-bit key is equivalent to a 3000-bit public key. Again, the bigger the key, the more
secure, but the algorithms used for each type of cryptography are very different and thus comparison is like that of
apples to oranges.

● While the public and private keys are mathematically related, it's very difficult to derive the private key given only the
public key; however, deriving the private key is always possible given enough time and computing power. This makes it
very important to pick keys of the right size; large enough to be secure, but small enough to be applied fairly quickly.
Additionally, you need to consider who might be trying to read your files, how determined they are, how much time
they have, and what their resources might be.

● Larger keys will be cryptographically secure for a longer period of time. If what you want to encrypt needs to be hidden
for many years, you might want to use a very large key. Keys are stored in encrypted form.

20
Symmetric and Asymmetric Key Cryptography
Cryptography is classified into symmetric key cryptography, asymmetric key cryptography.

Symmetric key cryptography


It involves usage of one secret key along with encryption and decryption algorithms which help in securing the contents of the message. The
strength of symmetric key cryptography depends upon the number of key bits. It is relatively faster than asymmetric key cryptography.
There arises a key distribution problem as the key has to be transferred from the sender to receiver through a secure channel.

21
Asymmetric key cryptography:
It is also known as public key cryptography because it involves usage of a public key along with secret key.

It solves the problem of key distribution as both parties uses different keys for encryption/decryption.

It is very slow compared to symmetric key cryptography.

22
Public key Cryptography
● The problems of key distribution are solved by public key cryptography, the concept of which was introduced by Whitfield Diffie
and Martin Hellman in 1975.

● Public key cryptography is an asymmetric scheme that uses a pair of keys for encryption: a public key, which encrypts data, and
a corresponding private, or secret key for decryption. You publish your public key to the world while keeping your private key
secret. Anyone with a copy of your public key can then encrypt information that only you can read. Even people you have never
met
.
● It is computationally infeasible to deduce the private key from the public key. Anyone who has a public key can encrypt
information but cannot decrypt it. Only the person who has the corresponding private key can decrypt the information.

● The primary benefit of public key cryptography is that it allows people who have no preexisting security arrangement to
exchange messages securely.

● Some examples of public-key cryptosystems are Elgamal (named for its inventor, Taher Elgamal), RSA (named for its inventors,
Ron Rivest, Adi Shamir, and Leonard Adleman), Diffie-Hellman (named, you guessed it, for its inventors), and DSA, the Digital
Signature Algorithm (invented by David Kravitz).

● Public key encryption is the technological revolution that provides strong cryptography to the adult masses.

23
Diffie-Hellman key exchange
Key exchange:
Establishing secret key when you have to exchange it with someone over public channel.

Diffie-Hellman key exchange:


It is also as called exponential key exchange, is a method of digital encryption that uses numbers raised
to specific powers to produce decryption keys on the basis of components that are never directly
transmitted, making the task of a would-be code breaker mathematically overwhelming.

24
Person A Person B

Choose p=23 (prime number) & g=5 (generator) , g<p publically


Secret key : a=6 Secret key: b=4
56(mod23) ≡ 8 (send to Person B) 54(mod23) ≡ 4 (send to person A)
46(mod23) ≡ 2
84(mod23) ≡ 2

ga(modp)=q1
gb(modp)=q2
(gb)a(modp)=q3(secret message) =
(ga)b(modp)=q3(secret message)

25
Diffie hellman key exchange uses discrete
logarithm problem.

If someone wants to decrypt the message they


should find the private key used.

The only way to find the private key is to go


backwards,
i.e., 5X(mod23)=8 or 5X(mod23)=4
which is very difficult as the private key
can be of larger digits and it can take years to
decrypt it.

The Discrete Logarithm Problem


Let G be a group whose group law we denote
by the symbol . The Discrete Logarithm
Problem for G is to determine, for any two
given elements g and h in G, an integer x
satisfying
g g g · · · g = h. (g is x times)

26
RSA Algorithm
RSA algorithm is asymmetric cryptography algorithm. Asymmetric actually means that it works on two different keys i.e. Public Key and
Private Key.

The idea of RSA is based on the fact that it is difficult to factorize a large integer. The public key consists of two numbers where one
number is multiplication of two large prime numbers. And private key is also derived from the same two prime numbers.

So if somebody can factorize the large number, the private key is compromised. Therefore encryption strength totally lies on the key
size and if we double or triple the key size, the strength of encryption increases exponentially. RSA keys can be typically 1024 or 2048
bits long.

The acronym RSA comes from the surnames of Ron Rivest, Adi Shamir and Leonard Adleman, who publicly described the algorithm in
1977.

The security of RSA relies on the practical difficulty of factoring the product of two large prime numbers, the "factoring problem".
Breaking RSA encryption is known as the RSA problem.

RSA is a relatively slow algorithm. Because of this, it is not commonly used to directly encrypt user data. More often, RSA is used to
transmit shared keys for symmetric key cryptography, which are then used for bulk encryption-decryption.

27
RSA algorithm
1. Choose two large primes p & q
Encryption : c≡me(mod N)

Decryption : m≡cd(mod N)
2. Factor N=p*q
C - cipher text , e- public key
3. Euler’s Totient function
ɸ(n)=(p-1)(q-1) M - message , d - private key

Example:
4. Choose ‘e’ & ‘d’
e: encryption such that 1<e<ɸ(n) & coprime with 1. Choose p=2 and q=7
N, ɸ(n) 2. N=2*7=14
d: decryption 3. ɸ(n)=(p-1)(q-1)=6
e*d(modɸ(n))=1 4. e=5, d=11
5. Public key is (e,N)= (5,14)
5. Publish (e,N) as the public key 6. Private key is (d,N)= (11,14)

6. (d,N) is the private key


28
Now (5,11) is the public key

Let us see how to encrypt and decrypt the message using public key and private key

Let say our message is ‘B’ Take the encrypted message 4

Convert B into numerical, B=2 (A=1,B=2,C=3….) Decryption:

Encryption: 411(mod14)=4194304mod(14)

25(mod14)=32mod(14)=4 =29959.1429...mod(14)

4 is the encrypted message 2(mod14)

4=D, D is the encrypted message i.e., 2 (B) is the original message.

29
Steps to follow in RSA algorithm
1. Generating the public key
2. Finding the private key
3. Encrypting the message
4. Decrypting the message.

30
Hash functions
Hashing is the process of changing a plain text or a key to a hashed value by applying a hash function. Usually, the
input length is greater in size than the output hash value.Hash function or hash algorithm creates a unique digital
fingerprint of data

The digital fingerprint of data is called digest or message digest or simply hash.

Hash algorithm are primarily used for comparison purpose not encryption.

Hash algorithms have 3 basic characteristics:

1. Secure : non-reversible function(one way function)


2. Fixed size- short or long data will produce fixed size digest
3. Unique: two different data sets cannot produce the same digest.

Hash algorithms are commonly used for passwords.


The passwords for any databases are secured in form of hashes and not just the plain text.
Some common hashing algorithms are SHA, Tiger, whirlpool, etc.

31
Purpose of hashing:
● It is easy to keep and find records of hashed data.
● You can use hashing in cryptographic applications like a digital signature.
● Hashing can create random strings that help in avoiding data duplication.
● Geometric hashing is used in computer graphics and helps to find proximity issues in planes.

32
Digital signatures
Digital signature is equivalent to handwritten signature.

It is electronic verification of the sender.

Digital signature serves 3 purposes:

1. Authentication: a digital signature gives receiver reason to believe the message was created and sent by
claimed sender
2. Non-repudiation: with digital signature the sender can not deny having sent the message on
3. Integrity: a digital signature ensures that the message was not altered in transit.

Digital signatures are commonly used for software distribution, financial transactions and other cases where it
is important to detect the forger and tampering. Digital signatures are very popular among email users.

Digital signature uses asymmetric key cryptography.

33
34
Applications of digital signature:
Saves time

Digital signatures ensure that businesses save on cost and time with documents and contracts signed off with a click of a button. Documents can

be signed off almost instantly, from anywhere. Be it a tablet, phone or computer, digital signatures can seamlessly ensure this otherwise tedious

task is wrapped up in minutes.

Cost savings

Many companies also see significant cost savings, with little or no expense in ink, paper, printing, scanning , shipping/delivery or travel expenses.

Workflow efficiency

With lesser delays, digital signatures ensure better efficiency in workflow. Many features of digital signatures help speed up the work process. For

instance, email notifications help remind the person to sign, while status tracking, help to know at which stage the document is at.

Security

When it comes to signatures, authenticity, and security are a priority. Digital signatures reduce the risk of duplication or alteration of the

document itself. Digital signatures ensure that signatures are verified, authentic and legitimate. Signers are provided with PINs, passwords, and

codes that can authenticate and verify their identity and approve their signatures. Time stamping provides the date and time of the signature and

thus provides a track of the document, minimizing any risk of tampering or fraud. Security features embedded in digital signatures ensure that

documents have not been altered without authorization.

35
Cryptography benefits and drawbacks
Benefits:
Cryptography is an essential information security tool. It provides the four most basic services of information
security −
● Confidentiality − Encryption technique can guard the information and communication from unauthorized
revelation and access of information.
● Authentication − The cryptographic techniques such as MAC and digital signatures can protect information
against spoofing and forgeries.
● Data Integrity − The cryptographic hash functions are playing vital role in assuring the users about the data
integrity.
● Non-repudiation − The digital signature provides the non-repudiation service to guard against the dispute
that may arise due to denial of passing message by the sender.
All these fundamental services offered by cryptography has enabled the conduct of business over the networks
using the computer systems in extremely efficient and effective manner.

36
Cryptography – Drawbacks

● A strongly encrypted, authentic, and digitally signed information can be difficult to access even for a
legitimate user at a crucial time of decision-making. The network or the computer system can be attacked
and rendered non-functional by an intruder.
● Cryptography comes at cost. The cost is in terms of time and money −
a. Addition of cryptographic techniques in the information processing leads to delay.
b. The use of public key cryptography requires setting up and maintenance of public key infrastructure
requiring the handsome financial budget.
● The security of cryptographic technique is based on the computational difficulty of mathematical problems.
Any breakthrough in solving such mathematical problems or increasing the computing power can render a
cryptographic technique vulnerable.

37
References
● An introduction to mathematical cryptography (2nd edition)
Jeffrey Hoffstein
Jill pipher
Joseph H.Silverman

● Numberphile

● Wolfrom mathematics world

● Wikipedia

38
Thank you!!!
39

You might also like