Professional Documents
Culture Documents
Encryption Techniques
Rola Naja
4
What is Cryptography?
Cryptology
Example
‘My earnest endeavours to appease the miserable
infant did not immediately gain her trust’
→ meet at midnight
11
Modular Arithmethic
A modulus of n is the size of the set {0, 1,
2, 3, … , (n-1)}.
modulus of n or modulo n.
Property of closure
Identity Property
Where there is one element (e) of a group which, when
combined mathematically with any other element (a), returns a,
then the element e is known as the identity of the group.
This can be expressed generally as
a º e ≡ a mod n or e º a ≡ a mod n
where the symbol º denotes any mathematical operation.
Commutative Property
If, when an operation is carried out in modular arithmetic, the
order in which the integers are placed does not affect the result,
this is known as the commutative property.
This can be expressed generally as:
(a º b) mod n ≡ (b º a) mod n
where the symbol º denotes any mathematical operation.
R.Naja-Chapter2: Encryption Techniques 17
Caesar Code
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
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
En Encryption table for the Caesar code highlighting the encrypted letters C, A and T
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
X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
A decryption table for the Caesar code. The letters F, D and W have been picked out
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 0 1 2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
23 24 25 26 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Compute a × b mod n
1-Multiply the two integers.
2-Divide the result by n:
(a x b) ÷ n = m, remainder d
a × b ≡ d mod n
Property of closure
Commutative Property
Modular multiplication is commutative.
a × b mod n ≡ b × a mod n
5 × 7 ≡ 3 mod 8
7 × 5 ≡ 3 mod 8
x × a × a ≡ x mod n
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
0 15 4 19 8 23 12 1 16 5 20 9 24 13 2 17 6 21 10 25 14 3 18 7 22 11
A P E T I X M B Q F U J Y N C R G V K Z O D S H W L
0 7 14 21 2 9 16 23 4 11 18 25 6 13 20 1 8 15 22 3 10 17 24 5 12 19
A H O V C J Q X E L S Z G N U B I P W D K R Y F M T
The decryption key is, the number that when multiplied, modulo 26, by the
encryption key gives the answer “1”
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 21 22 23 24 25
0
0 8 16 24 6 14 22 4 12 20 2 10 18 0 8 16 24 6 14 22 4 12 20 2 10 18
A I Q Y G O W E M U C K S A I Q Y G O W E M U C K S
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
0 8 16 24 3 11 19 27 6 14 22 1 9 17 25 4 12 20 28 7 15 23 2 10 18 26 5 13 21
H P X C K S < F N V A I Q Y D L S > G O W B J R Z E M U
3 (2 + 1) × 8 16 + 8 24 mod 29
modulus. 4 4×8 3 mod 29
So, 8 × k mod 29 ≡ 1
k = 11
XHO ➔ “24 8 15” ➔ “3 1 20” ➔ CAT
Decryption of ‘DC’
DC:(3*26+2)+1=81
Decryption key for K=677 is 303.
Decryption: 81 × 303 ≡ 171 mod 677
171-1=170=6*26+14
• ‘GO’
(n – 1)a mod n ≡ 1 or (n – 1)
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
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
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
0 1 24 7 25 24 23 7 20 20 25 16 1 16 23 23 16 1 16 25 20 20 7 23 24 25 7 24 1
W F X W V F S S X O O V V O O X S S F V W X F W
n 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 27
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6
11 × n mod 28 11 22 5 16 27 10 21 4 1 2 9 2 3 1 2 8 1 2 1 2 7 1 1 1 2 6 17
5 6 0 4 5 9 3 4 8 2 3
45
Cryptography
Imagine
you were a spy master.
You sent out James Bond into the field.
You sent him a key with an encryption
algorithm.
He was arrested and tortured.
He will give the key and the cipher will be
compromised!!!!!
p 0 1 2 3 4 5 6 7 8 9 10
p2 0 1
p 0 1 2 3 4 5 6 7 8 9 10
p3 0 1
Decryption: p ≡ cKmod N 0 1 2 3 4 5 6 7 8 9 0
• K=7 2 1 2 4 8 5 9 9 7 3 6 1
3 1 3 9 5 4 3 3 9 5 4 1
4 1 4 5 9 3 4 4 5 9 3 1
5 1 5 3 4 9 5 5 3 4 9 1
6 1 6 3 7 9 5 5 8 4 2 1
7 1 7 5 2 3 4 4 6 9 8 1
8 1 8 9 6 4 3 3 2 5 7 1
9 1 9 4 3 5 9 9 4 3 5 1
10 1 10 1 10 1 1 1 10 1 10 1
K ≡ Kn – 2 mod n
67
Cryptography
Cryptogtaphy:
Algorithm for encryption involving modular
arithmetic and using a pair of keys:
• Symmetric or Asymmetric
Encryption
These two classes differ in how they use keys:
Advantage Disadvantage
Symmetric Encryption
Symmetric algorithms use the same pre-shared key to encrypt and decrypt data.
Today, symmetric encryption algorithms are commonly used with VPN traffic. This is
because symmetric algorithms use less CPU than asymmetric encryption algorithms.
When using symmetric encryption algorithms, like any other type of encryption, the
longer the key, the longer it will take for someone to discover the key.
Most encryption keys are between 112 and 256 bits. Use a longer key for more secure
communications.
Confidentiality
The decryption key cannot, in any reasonable amount of time, be calculated from the
encryption key and vice versa.
security
? ?
Intruder: Eve
Bob Alice
R.Naja-Chapter2: Encryption
75 Techniques 75
RSA System
Main concern:
How can I choose a pair of complementary
encryption and decryption keys so that knowledge
of one does not help me find the other?
Centerpiece:
Themultiplication of two very large prime numbers,
and using the result as the modulus of the
encryption calculations.
Objectives:
choosean encryption key and calculate the
decryption key according to certain conditions.
R.Naja-Chapter2: Encryption Techniques 78
RSA Algorithm
RSA
Encryption: modular exponentiation
Encryption and decryption keys derived from
secret data.
• using a difficult but tractable process.
_
8- Compute
_ the decryption key K from
K ≡ Kø(m)-1 mod m
_
9-Check that K × K ≡ 1 mod m
Let’s choose 13 : K = 13