Introduction to
Cryptography
by Petre POPESCU
What is cryptography?
"the art of hiding information"
OR
"the practice and study of techniques for secure
communication in the presence of third parties"
(wikipedia)
Modern Cryptography
a branch of mathematics
and
computer science
Modern Cryptography
2 main branches
1. Private Key Cryptography
2. Public Key Cryptography
Private Key Cryptography
The same key is used for both
encryption and decryption
Private Key Cryptography
Examples:
- DES
- AES
- Caesar Cipher
- Blowfish
Caesar Cipher
Named after Julius Caesar, who used it
in his private and military
correspondence.
Caesar Cipher
It is a substitution cipher
Each letter is replaced by another letter
depending on a "shift" value
Caesar Cipher
Cracking Caesar Cipher
(assuming we know Caesar Cipher is used)
1. Brute Force Attack
2. Word-pattern and letter distribution
attack
Brute Force Attack
Since the number of possible shifts is
limited, it is feasible to try each shift
and discard the results that are not
human readable.
Word-pattern and letter distribution attack
Step 1:
Find the average distribution of letter
in that language.
This can be done with ease by
analyzing long texts.
Word-pattern and letter distribution attack
Step 2:
A Caesar Cipher usually "shifts" this
distribution by the shift used for
encryption.
An error margin is permitted, so now
multiple possibilities are generated.
Word-pattern and letter distribution attack
Step 3:
Decrypt the text using the possible
shifts that were found in step 2.
Use word-pattern analysis (and
possibly a dictionary of words) to
discover the correct variant
Public Key Cryptography
Two keys are needed:
- one for encrypting the message
- one for decrypting the message
Public Key Cryptography
Key's properties
- neither keys can perform both
operations
- the two keys are mathematically
paired
- public key - used for encryption
- private key - used for decryption
Public Key Cryptography
Examples:
- RSA
- YAK
- Various elliptic curve techniques
RSA
Created by:
Ron Rivest
Adi Shamir
Leonard Adleman
Is based on the presumed difficulty of
factoring large integers.
RSA - Generating the two keys
(1) Choose two distinct prime numbers:
p and q
p and q should have high bit-length
p and q should be chosen at random
RSA - Generating the two keys
(2) Compute
n = pq
n is the "modulus" for both the public
and private keys
RSA - Generating the two keys
(3) Compute
φ(n) = φ(p)φ(q) = (p − 1)(q − 1)
RSA - Generating the two keys
(4) Choose e such that
1 < e < φ(n)
and
gcd(e, φ(n))
TIP: e and φ(n) are coprime
RSA - Generating the two keys
"e" is the Public Key Exponent
RSA - Generating the two keys
(5) Compute d where
d−1
≡ e (mod φ(n))
or
d is the multiplicative inverse of
e (modulo φ(n))
RSA - Generating the two keys
To calculate d
solve for d given
d*e ≡ 1 (mod φ(n))
RSA - Generating the two keys
Public Key: e and n
Private Key: d and n
d, p, q and φ(n) must be kept secret

Introduction to Cryptography