Chapter2 - Cryptography
Chapter2 - Cryptography
CRYPTOGRAPHY
Cryptography
• Cryptographic algorithm converts a plain text block
into an encrypted block
Original
Plaintext
Plaintext Ciphertext
Encryption Decryption
Original
Plaintext Ciphertext Plaintext
Encryption Decryption
• Block size
– increasing size improves security, but slows cipher
• Key size
– increasing size improves security, makes exhaustive key
searching harder, but may slow cipher
• Number of rounds
– increasing number improves security, a typical size is 16
rounds
• Sub key generation
– greater complexity can make analysis harder
• Round function
– greater complexity can make greater resistance to
cryptanalysis
Considerations in the design of
Feistel cipher
• Fast software en/decryption
– are more recent concerns for practical use and testing
– Encryption is embedded in such a way as to preclude a
hardware implementation
… …
Initial Permuted Choice
Permutation 1
K1 Permuted Choice
Round 1 Left Circular Shift
2
K2 Permuted Choice
Round 2 Left Circular Shift
2
32-bit Swap
Inverse Initial
Permutation
…
64-bit Ciphertext
• Initial key consists of 64 bits
1. Key transformation
2. Expansion Permutation
3. S-box substitution
4. P-box substitution
5. XOR and Swap
Steps in a single round
Details of a single Round
Substitution Box
(S-Box)
32 bits
Permutation Box
(P)
32 bits
X
O
R
32 bits
Li Ri Ci Di
• The 64 bit data is divided into two 32-bit L & R
halves
1. Double DES
2. Triple DES
Double DES
• It uses two keys K1 and K2
• First performs DES on original plain text using
K1 to get encrypted text
• Again performs DES on encrypted text with
the key K2
Encryption
K1 K2
Decryption
K2 K1
Triple DES
• It is DES –three times
• It includes
1. Triple DES with three keys
2. Triple DES with two keys
Triple DES with three keys
• It is a block cipher
XOR
Addition modulo
Multiplication modulo
• If the result of an addition or multiplication of
two 16 bit numbers contains more than 17 bit,
we have to bring it back to 16 bit
• For this purpose we are using the modulo
function
• Various steps involved in one round of IDEA
are as follows
Step1: Multiply* P1 and k1
Step2: Add* P2 and k2
Step3: Add* P3 and k3
Step4: Multiply* P4 and k4
Step5: XOR the result of step1 and step3
Step6: XOR the result of step2 and step4
Step7: Multiply* the result of step5 with k5
Step8: Add* the result of step6 and step7
Step9: Multiply* the result of step8 with k6
Step10: Add* the result of step7 and step9
Step11: XOR the result of step1 and step9
Step12: XOR the result of step3 and step9
Step13: XOR the result of step2 and
step10
Step14: XOR the result of step4 and
step10
Key Expansion
• Each of the eight rounds make use of six
sub-keys and output transformation uses four
sub-keys
.
• In this user has a pair of keys
• Incoming
. messages would have been
encrypted with the recipient's public key
and can only be decrypted with his
corresponding private key
Public key cryptosystems are based upon the
following idea
Plaintext : M<n
e
Ciphertext : C = M (mod n)
RSA Decryption
• A can recover M from C by using her
private key
• It uses the computation
M=Cd(mod n)
Ciphertext : C
d
Plaintext : M= C (mod n)
Example
de modφ(n) = 1
d * 5 mod 96 = 1
• D = e-1 modφ(n)
So that
77 *5 mod 96 =1
385 mod 96 = 1
1 =1
• Assume A want send a character F to B