SlideShare a Scribd company logo
Introduction to Network Security
Lecture 2: Caesar and RSA
Location:E.T.S. de Ingenierias Informatica y de Telecomunicacion Universidad
de Granada 18071, Granada (SPAIN), 24-28 April 2017
Dr. Tarek Gaber
Faculty of Computers and Informatics,
Suez Canal University, Ismailia, Egypt
tmgaber@gmail.com
Lecture Objectives
To learn Caesar encryption as
an example of symmetric
encryption techniques
To learn RSA encryption as an
example of asymmetric
encryption techniques
Lecture Outlines
What is Caesar Algorithm
How does Caesar algorithm works
What is RSA technique
Simple numerical example of RSA
Caesar Cipher
• The earliest known as substitution cipher by
Julius Caesar
• First attested use in military affairs
• Replaces each letter by 3rd letter later
• example:
meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
http://www.xarg.org/tools/caesar-
cipher/
What is a Caesar Cipher?
• Caesar used to encrypt his messages using a very simple
algorithm, which could be easily decrypted if you know
the key.
• He would take each letter of the alphabet and replace it
with a letter a certain distance away from that letter.
When he got to the end, he would wrap back around to
the beginning.
• Example with a shift of 3:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
https://www.youtube.com/watch?v=fR8rVR72a6o
Caesar Wheel
Caesar Cipher
• can define transformation as:
a b c d e f g h i j k l m n o p q r s t u v w x y z
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
• mathematically give each letter a number
a b c d e f g h i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
• then have Caesar cipher as:
C = E(p) = (p + k) mod (26)
p = D(C) = (C – k) mod (26)
MOD Function
• MOD is short for modulus, which means ' the remainder left
over after a value is divided by something'
Examples:
27 mod 26... 27 / 26 is 1 R 1, so 27 mod 26 is 1
53 mod 26... 53 / 26 is 2 R 1 so 53 mod 26 is also 1
10 mod 3 is also 1 (since 10 / 3 = 3 R 1)
2 mod 2 = 0
5 mod 2 = 1
25 mod 26 = 25
50 mod 26 = 24
• if a = (b) mod c then a = (c*k + b) mod c (where k = 1,2,3.......)
• So, if we have (-4 mod 3), we could write it as ( 3x2 -4) mod 3 =2
Caesar Algorithm
• 1. Convert the characters to numbers
2. Pick a number to shift by
3. Add the number to each character
4. Mod each resulting number by 26
5. You message is now encrypted!
Cryptanalysis of Caesar Cipher
• only have 26 possible ciphers
– A maps to A,B,..Z
• could simply try each in turn
• a brute force search
• given ciphertext, just try all shifts of letters
• do need to recognize when have plaintext
• eg. break ciphertext “ERE L ORYH BRX
DOLFH“ (HOMEWORK)
The Problem with Caesar’s Cipher
• It’s too easy to break! Let’s go back to our five letter alphabet.
• Say you had the word DBCA, but didn’t know the key. It would be easy to
make a list of all possible keys. If you expected the unencrypted text to be
in English, you could easily figure out which word was right:
• If you were using the full English alphabet, this would take longer, but for
someone trying to find our your secret, it’s a small price to pay!
Shift of 1 CABE
Shift of 2 BEAD  The clear winner!
Shift of 3 ADEC
Shift of 4 ECDB
How dare you
insult my cipher!
Though, you have
a good point…
RSA Algorithm
• The RSA algorithm is named after Ron Rivest, Adi Shamir and Len
Adleman, who invented it in 1977.
• The RSA cryptosystem is the most widely-used public key
cryptography algorithm in the world. It can be used to encrypt a
message without the need to exchange a secret key separately.
• The RSA algorithm can be used for both public key encryption
and digital signatures.
• Its security is based on the difficulty of factoring large integers.
Prime Number
• A Prime Number can be divided evenly only by
1 or itself and it must be a whole number
greater than 1.
• Examples:
– Is 8 a Prime Number?
• No, because it can be divided evenly by 2 or 4 (2×4=8),
as well as by 1 and 8.
– Is 73 a Prime Number?
• Yes, it can only be divided evenly by 1 and 73.
Prime and Co-prime Number
• Two numbers are said to be Co-primes when they
have only 1 as a common factor.
• Example 1: Are numbers 6 and 25 Coprime ?
Answer = Two given numbers are 6 and 25
Factors of 6 = 1, 2, 3, 6 and Factors of 25 = 1, 5, 25
On comparing the factors of numbers 6 and 25, you can see
that both have only 1 as a common factor, So, 6 and 25 are
Coprimes.
• The Factors of a given number are those which divide
a given number completely, without leaving any
remainder.
– Factors of a given number 12 are 1, 2, 3, 4, 6 & 12
RSA Key Generation Algorithm
• Generate two large random primes, p and q, of
approximately equal size such that their product n =
pq is of the required bit length, e.g. 1024 bits.
• Compute n = pq and (phi) φ = (p-1)(q-1).
• Choose an integer e, 1 < e < phi, such that gcd(e, phi)
= 1. Compute the secret exponent d, 1 < d < phi, such
that ed ≡ 1 (mod phi).
– ( e *d) / phi = ? with the remainder of 1, (1 mod phi equivalent to e*d
mod phi).
• The public key is (n, e) and the private key (p, q, d) or
(n, d).
• Keep all the values d, p, q and phi secret.
Summary of RSA
• Key Generation
– n = pq, where p and q are distinct primes.
– phi, φ = (p-1)(q-1)
– e < n such that gcd(e, phi)=1
– d = e-1 mod phi.
• Encryption/Decryption
– c = me mod n, 1<m<n.
– m = cd mod n.
Homework (Caesar and RSA)
• Using the Caesar algorithm, how you can get the key
used to get the ciphertext “ERE L ORYH BRX DOLFH“ and
what should be the plaintext of this ciphertext.
• In the RSA numerical example given in the lecture, we
have chosen e = 7,
– change e to 11,
– compute d, and
– compute the public and private key pair
– encrypt the message M =2
• Send it to tmgaber@gmai.com by 12:00 (PM) 27-4-2017
Thanks for your attention
Questions, please

More Related Content

PPTX
RSA Algorithm
PPSX
Prime numbers
PDF
Computer Security Lecture 7: RSA
PDF
RSA ALGORITHM
PDF
Network security CS2
PPT
Rsa rivest shamir adleman
PPTX
Information and network security 33 rsa algorithm
PPTX
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
RSA Algorithm
Prime numbers
Computer Security Lecture 7: RSA
RSA ALGORITHM
Network security CS2
Rsa rivest shamir adleman
Information and network security 33 rsa algorithm
Implementation of RSA Algorithm for Speech Data Encryption and Decryption

What's hot (20)

PPT
The rsa algorithm JooSeok Song
PPT
Lecture6 rsa
PDF
Ntewrok secuirty cs7
PDF
RSA Algorithm
PPT
The rsa algorithm
PPT
The rsa algorithm
PPT
PPTX
RSA algorithm
PPTX
RSA ALGORITHM
PPTX
Public Key Algorithms
PPT
The rsa algorithm
PDF
RSA Algorithm report
PPTX
RSA-W7(rsa) d1-d2
PDF
Network security cs5
PPT
RSA Algorithm - Public Key Cryptography
PPTX
Rsa Crptosystem
PPT
RSA Algorithm
PDF
Presentation about RSA
PPT
Information and Network Security
The rsa algorithm JooSeok Song
Lecture6 rsa
Ntewrok secuirty cs7
RSA Algorithm
The rsa algorithm
The rsa algorithm
RSA algorithm
RSA ALGORITHM
Public Key Algorithms
The rsa algorithm
RSA Algorithm report
RSA-W7(rsa) d1-d2
Network security cs5
RSA Algorithm - Public Key Cryptography
Rsa Crptosystem
RSA Algorithm
Presentation about RSA
Information and Network Security
Ad

Similar to Simple Overview Caesar and RSA Encryption_by_Tarek_Gaber (20)

PPTX
229301131_Hamza Ikram PPT by ahmad .pptx
PPTX
Cryptography and applications
PPT
encryptcryptographyyyyyyyyyyyyyyyyyy.ppt
PPTX
Cryptography
PPTX
Cryptography
PPTX
Cryptography and its types and Number Theory .pptx
PPTX
Cryptography
PDF
Improved Caesar Cipher with Random Number Generation Technique and Multistage...
PDF
Improved Caesar Cipher with Random Number Generation Technique and Multistage...
PPTX
Classical$ nn Encryption Techniques.pptx
PPTX
cryptographyyy .pptx
PPT
PDF
Classical Encryption Techniques.pdf
PPTX
Cryptography - Discrete Mathematics
PPSX
Introductory Lecture on Cryptography and Information Security
PPTX
IANSunit 1_cryptography_2.pptxv xvxvxvxv
PPT
Computer systems security 7-cryptography.ppt
PPT
EncryptionTechChap2.ppt
PPT
CryptographyCryptographyCryptography.ppt
229301131_Hamza Ikram PPT by ahmad .pptx
Cryptography and applications
encryptcryptographyyyyyyyyyyyyyyyyyy.ppt
Cryptography
Cryptography
Cryptography and its types and Number Theory .pptx
Cryptography
Improved Caesar Cipher with Random Number Generation Technique and Multistage...
Improved Caesar Cipher with Random Number Generation Technique and Multistage...
Classical$ nn Encryption Techniques.pptx
cryptographyyy .pptx
Classical Encryption Techniques.pdf
Cryptography - Discrete Mathematics
Introductory Lecture on Cryptography and Information Security
IANSunit 1_cryptography_2.pptxv xvxvxvxv
Computer systems security 7-cryptography.ppt
EncryptionTechChap2.ppt
CryptographyCryptographyCryptography.ppt
Ad

More from Tarek Gaber (15)

PDF
Writing a Successful Paper (Academic Writing Engineering)
PDF
Feature Selection Method Based on Chaotic Maps and Butterfly Optimization Alg...
PDF
Thermal Imaging: Opportunities and Challenges for Breast Cancer Detection
PDF
Using Google Scholar to get similar paper to your class/gradation project
PDF
Brief Guidelines for Writing Graduation Project Thesis
PDF
Simple Overview of PKI and Digital signature by Tarek_Gaber
PPTX
Integer Wavelet Transform for Thermal Image Authentication
PPT
Segmentation of thermograms breast cancer tarek-to-slid share
PPTX
Touch paper presentation-tarek
PDF
Overview on security and privacy issues in wireless sensor networks-2014
PPT
Sift based arabic sign language recognition aecia 2014 –november17-19, addis ...
PPT
Fair and abuse free contract signing protocol supporting fair license reselli...
PPTX
Drm digital rights managment-june2014-tarek gaber
PPT
A novel approach to allow multiple resales of DRM protected contents - icces2...
PPTX
تطبيق محمول للصم والبكم يحول الاشارات الى صوت Unesco-cairo-13-2-2014
Writing a Successful Paper (Academic Writing Engineering)
Feature Selection Method Based on Chaotic Maps and Butterfly Optimization Alg...
Thermal Imaging: Opportunities and Challenges for Breast Cancer Detection
Using Google Scholar to get similar paper to your class/gradation project
Brief Guidelines for Writing Graduation Project Thesis
Simple Overview of PKI and Digital signature by Tarek_Gaber
Integer Wavelet Transform for Thermal Image Authentication
Segmentation of thermograms breast cancer tarek-to-slid share
Touch paper presentation-tarek
Overview on security and privacy issues in wireless sensor networks-2014
Sift based arabic sign language recognition aecia 2014 –november17-19, addis ...
Fair and abuse free contract signing protocol supporting fair license reselli...
Drm digital rights managment-june2014-tarek gaber
A novel approach to allow multiple resales of DRM protected contents - icces2...
تطبيق محمول للصم والبكم يحول الاشارات الى صوت Unesco-cairo-13-2-2014

Recently uploaded (20)

PPTX
Cell Structure & Organelles in detailed.
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PDF
Basic Mud Logging Guide for educational purpose
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Lesson notes of climatology university.
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
master seminar digital applications in india
Cell Structure & Organelles in detailed.
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Supply Chain Operations Speaking Notes -ICLT Program
Complications of Minimal Access Surgery at WLH
Basic Mud Logging Guide for educational purpose
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Lesson notes of climatology university.
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
01-Introduction-to-Information-Management.pdf
TR - Agricultural Crops Production NC III.pdf
Microbial diseases, their pathogenesis and prophylaxis
2.FourierTransform-ShortQuestionswithAnswers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial disease of the cardiovascular and lymphatic systems
master seminar digital applications in india

Simple Overview Caesar and RSA Encryption_by_Tarek_Gaber

  • 1. Introduction to Network Security Lecture 2: Caesar and RSA Location:E.T.S. de Ingenierias Informatica y de Telecomunicacion Universidad de Granada 18071, Granada (SPAIN), 24-28 April 2017 Dr. Tarek Gaber Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt tmgaber@gmail.com
  • 2. Lecture Objectives To learn Caesar encryption as an example of symmetric encryption techniques To learn RSA encryption as an example of asymmetric encryption techniques
  • 3. Lecture Outlines What is Caesar Algorithm How does Caesar algorithm works What is RSA technique Simple numerical example of RSA
  • 4. Caesar Cipher • The earliest known as substitution cipher by Julius Caesar • First attested use in military affairs • Replaces each letter by 3rd letter later • example: meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB http://www.xarg.org/tools/caesar- cipher/
  • 5. What is a Caesar Cipher? • Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key. • He would take each letter of the alphabet and replace it with a letter a certain distance away from that letter. When he got to the end, he would wrap back around to the beginning. • Example with a shift of 3: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z D E F G H I J K L M N O P Q R S T U V W X Y Z A B C https://www.youtube.com/watch?v=fR8rVR72a6o
  • 7. Caesar Cipher • can define transformation as: a b c d e f g h i j k l m n o p q r s t u v w x y z D E F G H I J K L M N O P Q R S T U V W X Y Z A B C • mathematically give each letter a number a b c d e f g h i j k l m 0 1 2 3 4 5 6 7 8 9 10 11 12 n o p q r s t u v w x y Z 13 14 15 16 17 18 19 20 21 22 23 24 25 • then have Caesar cipher as: C = E(p) = (p + k) mod (26) p = D(C) = (C – k) mod (26)
  • 8. MOD Function • MOD is short for modulus, which means ' the remainder left over after a value is divided by something' Examples: 27 mod 26... 27 / 26 is 1 R 1, so 27 mod 26 is 1 53 mod 26... 53 / 26 is 2 R 1 so 53 mod 26 is also 1 10 mod 3 is also 1 (since 10 / 3 = 3 R 1) 2 mod 2 = 0 5 mod 2 = 1 25 mod 26 = 25 50 mod 26 = 24 • if a = (b) mod c then a = (c*k + b) mod c (where k = 1,2,3.......) • So, if we have (-4 mod 3), we could write it as ( 3x2 -4) mod 3 =2
  • 9. Caesar Algorithm • 1. Convert the characters to numbers 2. Pick a number to shift by 3. Add the number to each character 4. Mod each resulting number by 26 5. You message is now encrypted!
  • 10. Cryptanalysis of Caesar Cipher • only have 26 possible ciphers – A maps to A,B,..Z • could simply try each in turn • a brute force search • given ciphertext, just try all shifts of letters • do need to recognize when have plaintext • eg. break ciphertext “ERE L ORYH BRX DOLFH“ (HOMEWORK)
  • 11. The Problem with Caesar’s Cipher • It’s too easy to break! Let’s go back to our five letter alphabet. • Say you had the word DBCA, but didn’t know the key. It would be easy to make a list of all possible keys. If you expected the unencrypted text to be in English, you could easily figure out which word was right: • If you were using the full English alphabet, this would take longer, but for someone trying to find our your secret, it’s a small price to pay! Shift of 1 CABE Shift of 2 BEAD  The clear winner! Shift of 3 ADEC Shift of 4 ECDB How dare you insult my cipher! Though, you have a good point…
  • 12. RSA Algorithm • The RSA algorithm is named after Ron Rivest, Adi Shamir and Len Adleman, who invented it in 1977. • The RSA cryptosystem is the most widely-used public key cryptography algorithm in the world. It can be used to encrypt a message without the need to exchange a secret key separately. • The RSA algorithm can be used for both public key encryption and digital signatures. • Its security is based on the difficulty of factoring large integers.
  • 13. Prime Number • A Prime Number can be divided evenly only by 1 or itself and it must be a whole number greater than 1. • Examples: – Is 8 a Prime Number? • No, because it can be divided evenly by 2 or 4 (2×4=8), as well as by 1 and 8. – Is 73 a Prime Number? • Yes, it can only be divided evenly by 1 and 73.
  • 14. Prime and Co-prime Number • Two numbers are said to be Co-primes when they have only 1 as a common factor. • Example 1: Are numbers 6 and 25 Coprime ? Answer = Two given numbers are 6 and 25 Factors of 6 = 1, 2, 3, 6 and Factors of 25 = 1, 5, 25 On comparing the factors of numbers 6 and 25, you can see that both have only 1 as a common factor, So, 6 and 25 are Coprimes. • The Factors of a given number are those which divide a given number completely, without leaving any remainder. – Factors of a given number 12 are 1, 2, 3, 4, 6 & 12
  • 15. RSA Key Generation Algorithm • Generate two large random primes, p and q, of approximately equal size such that their product n = pq is of the required bit length, e.g. 1024 bits. • Compute n = pq and (phi) φ = (p-1)(q-1). • Choose an integer e, 1 < e < phi, such that gcd(e, phi) = 1. Compute the secret exponent d, 1 < d < phi, such that ed ≡ 1 (mod phi). – ( e *d) / phi = ? with the remainder of 1, (1 mod phi equivalent to e*d mod phi). • The public key is (n, e) and the private key (p, q, d) or (n, d). • Keep all the values d, p, q and phi secret.
  • 16. Summary of RSA • Key Generation – n = pq, where p and q are distinct primes. – phi, φ = (p-1)(q-1) – e < n such that gcd(e, phi)=1 – d = e-1 mod phi. • Encryption/Decryption – c = me mod n, 1<m<n. – m = cd mod n.
  • 17. Homework (Caesar and RSA) • Using the Caesar algorithm, how you can get the key used to get the ciphertext “ERE L ORYH BRX DOLFH“ and what should be the plaintext of this ciphertext. • In the RSA numerical example given in the lecture, we have chosen e = 7, – change e to 11, – compute d, and – compute the public and private key pair – encrypt the message M =2 • Send it to tmgaber@gmai.com by 12:00 (PM) 27-4-2017
  • 18. Thanks for your attention Questions, please