Cryptography PART 2
Cryptography PART 2
BLOCK CIPHERS
Block cipher
Block Ciphers Vs Stream Ciphers
⚫ Stream ciphers
– Faster Encryption
– Low error Propagation
– Low Diffusion
⚫ Block Ciphers
– Slow Encryption
– High error propagation
– High diffusion
Properties of Block Ciphers
⚫ Correctness
– For a given key, one-to-one mapping between plaintext and
ciphertext
⚫ Two or more plain text cannot map to the same cipher text
⚫ The same plain text can not be mapped to two or more ciphertext
⚫ Efficiency: Encryption and Decryption time should be
in Polynomial time
⚫ Secure: Encryption should satisfy, mapping between
input and output generated by a Random permutation
– One-bit change in the input, half output bits should be changed
Implementation Block ciphers
⚫ Ke = Kd .
⚫ Algorithms are fast and suitable for software and
hardware implementations.
⚫ The common key has to be agreed upon by Alice and
Bob before the actual communication.
⚫ Each pair of communicating parties needs a secret
key.
⚫ If there are many communicating pairs, the key
storage requirement is high.
Contd…
⚫ Substitution cipher
– Changes its identity but retains its position
– Simple process and easy to crack the code
– Ex: cease cipher
⚫ Transposition cipher
– Changes its position, but retains its identity
– Complex and difficult to crack
– Ex: Columnar transposition ciphers
Components used in Block ciphers
Confusion:
– The relationship between the key and ciphertext is obscured
⚫ A common element for achieving confusion is substitution
⚫ The property of confusion hides the relationship between the ciphertext
and the key
⚫ SBOX: It is a key-less fixed substitution cipher
Diffusion:
Influence of one each plain text bit spread over many cipher text
bits
– if we change a single bit of the plaintext, then (statistically) half of the bits in the
ciphertext should change,
– Similarly, if we change one bit of the ciphertext, then approximately one-half of the
plaintext bits should change
– PBOX: It is a key-less fixed transposition cipher
Feistel Cipher
⚫ Feistel cipher refers to a type of block cipher design,
not a specific cipher
⚫ Split plaintext block into left and right halves:
Plaintext = (L0,R0)
⚫ For each round i=1,2,...,n, compute
Li= Ri−1
Ri= Li−1 F(Ri−1,Ki)
where F is round function and Ki is subkey
⚫ Ciphertext = (Ln,Rn)
The parameters and design
features of Feistel network
⚫ Block size:
– Larger block sizes mean greater security but reduced
encryption/decryption speed for a given algorithm.
– Traditionally, a block size of 64 bits
⚫ Key size:
– Larger key size means greater security but may decrease
encryption/decryption speed
– Key sizes of 64 bits or less are now widely considered to be inadequate.
128 bits has become a common size
⚫ Number of rounds:
– A single round offers inadequate security but multiple rounds offer
increased security. A typical size is 16 rounds
Contd…
⚫ Rounds: Ensure each plain text input bit affects most
ciphertext output bits
– Diffuses better
– Only one round will change one-bit change
Contd…
⚫ Subkey generation algorithm:
– Greater complexity in this algorithm should lead to greater
difficulty of cryptanalysis
⚫ Round function F:
– Greater complexity generally means greater resistance to
cryptanalysis.
⚫ Fast software encryption/decryption:
– In many cases, encryption is embedded in applications in
such a way as to preclude a hardware implementation
⚫ Ease of analysis:
– make our algorithm as difficult as possible to cryptanalysis.
Data Encryption Standard
⚫ DES is the most widely used encryption scheme, adopted in
1977
⚫ National Bureau of Standards, now
⚫ National Institute of Standards and Technology (NIST)
⚫ Features:
– Block size = 64 bits
– Key size = 56 bits (in reality, 64 bits)
– Number of rounds = 16
– 16 intermediary keys, each 48 bits
General Depiction
of DES Encryption
Algorithm
The details
of one round
of DES
Initial Permutation (IP)
Ans: Row-3
Column-1
Value is 12
Output: 1100
S-boxes
Key generation
⚫ Security issue
– when jth plaintext is known, the jth output of the forward cipher
function will be known
– Easily cover jth plaintext block of other message with the same IV
⚫ Require that the IV is a nonce
Cipher FeedBack (CFB)
I
W
N
Mathematical Background
⚫ Will focus on these two topics
– Abstract Algebra
– Number Theory
⚫ Cryptography requires sets of integers and specific
operations that are defined for those sets
⚫ The combination of the set and the operations that are
applied to the elements of the set is called an algebraic
structure
Contd…
⚫ Abstract Algebra
– Group {G, .}
– Ring {R, +, *}
– Field {F, +, *, multiplicative inverse}
⚫ These are three different sets with different operations
⚫ Classification of each set, depends on the Axioms it satisfies
Definitions
⚫ Set
– Is a distinct collection of well-defined objects
– Example:
⚫ N={1,2,3…..N}
– Set of natural numbers
Group (G, *)
⚫ A Group(G, *) Is a nonempty set G together with a binary
operation (*) on G that the following condition hold:
– Closure: For all a, b 𝜖 G, the elements a+b 𝜖 G
– Inverse: Each element in G has a inverse i.e. ∀a 𝜖G ,
a+a-1=a-1+a=0
– Associativity: For a, b, c 𝜖 G, we have
a+(b+c)=(a+b)+c
– Identity: there exist identity elements e 𝜖 G such that,
∀a 𝜖G, a+e= e+a=a
Contd…
Example:
– A set of Natural numbers (N, +) is not a group, as it does not
satisfy the Inverse Ex: 3+ (-3)=0, but (-3) does not belong to I
– A set of Integers (I, *) is not a group, as it does not satisfy
Identity 3*1/3= 1, but 1/3 does not belong to I
– A set of Rational numbers (Q, +) is a Group
Abelian Group
⚫ Conditions are
– It should be a group and should satisfy (Closure,
Associative, Identity, and Inverse)
– Commutative Property
⚫ ∀ a,b 𝜖 G, a*b=b*a
⚫ Eexample (R,+) is an Abelian Group
⚫ (R,*) is an Abelian Group
Ring (+, *)
⚫ It consists of a set equipped with two binary operations that
generalize the arithmetic operations of additions and
multiplications
⚫ Ring can also be a group with additional features
Multiplication:
Addition:( +)
⚫Closure: a.b 𝜖 G
⚫Closure: a+b 𝜖 G
⚫Inverse: Each has an additive inverse
⚫Inverse: Each has an additive inverse
⚫ Associativity: a.(b.c)=(a.b).c
⚫ Associativity: a+(b+c)=(a+b)+c
⚫ Distributive property:
⚫ Identity: a+0= a
a.(b+c)=a.b+a.c, (a+b).c=a.c+b.c
⚫ Integers, Real numbers, and Complex numbers are Ring
Fields (+,*)
⚫ Field (F, +,*) is a set of elements with two binary operations
such as Addition and Multiplication and the following Axioms
are satisfied: ( if a, b, c are elements of F)
For Addition operation For Multiplication
1 Closure 6 Closure 11 No zero divisor
2 Associative 7 Associative
3 Additive Identity 8 Multiplicative identity
4 Additive inverse 9 Distributive 12 Multiplicative
5Commutative 10 Commutative inverse
A1-A4 is Group,
A1-A5 &M6-M9 is
A1-A5 is Abilian Group
Commutative Ring A1-A5 &M6-M11 is A1-A5 &M6-M12 is
A1-A5 &M6-M8 Field
Integral Domain
Properties of Groups, Rings, and Fields
Modular Arithmetic
matrix
⚫ C0=(02*B0)+(03*B5)+(01*B10)+(01*B15)
⚫ C1=(01*B0)+(02*B5)+(03*B10)+(01*B15)
⚫ C2=(01*B0)+(01*B5)+(02*B10)+(03*B15)
⚫C3=(03*B0)+(01*B5)+(01*B10)+(02*B15)
Contd…
Substitute bytes
⚫ W8= W4 Ex-OR G(W3)
⚫ W9 = W8 Ex-OR W5
⚫ W10 = W9 Ex-OR W6
⚫ W11 = W10 Ex-OR W7
Example
D R E A M B I G W O R K H A R D
68 82 69 65 77 66 73 71 87 79 82 75 72 65 82 68
68 77 87 72
82 66 79 65
69 73 82 82
65 71 75 68
W0 W1 W2 W3
Function (g)
⚫
Decryption
AES decryption round function
Properties of Modular Arithmetic
a+e=a
e is an additive identity
mod 8 additive element is 0
Multiplication modulo 8
⚫ Conclusion:
⚫ a is relative prime to n, then multiplicative inverse exist
Additive and multiplicative inverse
of mod 8
a Additive Multiplicative
inverse Inverse
0 0 -----
1 7 1
2 6 ----
3 5 3
4 4 ----
5 3 5
6 2 -----
7 1 7
Z7