Ch08 Cryptography
Ch08 Cryptography
n:a r:e g:t b:o v:i a:n x:k y:l s:f u:h t:g
i:v f:s o:b e:r p:c q:d j:w h:u w:j l:y z:m
Hill Cipher
GYBNQKURP
GYBNQKURP
Hill Cipher
Plaintext : ACT
Encryption
Decryption
Plaintext: attackatdawn
KEY: LEMONLEMONLE
Ciphertext: LXFOPVEFRNHR
• Encryption
Vigenère • Ei = (Pi + Ki) mod 26
cipher • Decryption
• Di = (Ei - Ki) mod 26
Vernam Cipher
The key must be at least as long as the plaintext.
For Example:
• ECB (Electronic Code Book)
• CBC (Cipher Block Chaining)
• CTR (Counter)
ECB MODE:
Modes of
Operation
CTR (Counter):
Each encryption block operation is partially dependent of adjacent blocks
N.B: If a given key k is used to encrypt several identical plaintext blocks mi then
different ciphertext blocks ci result
Data Encryption Standard (DES)
• Why AES, not DES ???
• In 1990's the cracking of DES algorithm became possible. Around 50 hours of
brute-forcing allowed to crack the message.
• Requirements from National Institute of Standards and Technology (NIST) was
that it had to be efficient both in software and hardware implementations. DES
was originally practical only in hardware implementations.
• DES is insecure due to the relatively short 56 bits key size where AES allows to
choose the option for various key lengths like 128-bit, 192-bit or 256-bit key,
making it exponentially stronger than the 56-bit key of DES.
• NIST started searching for new feasible algorithm and proposed its
requirement in 1997 and put out a public call for a replacement to DES.
Why AES , not DES ???
• NIST arranged a competition and narrowed down the list of
submissions to five finalists.
• In 2001 Rijndael algorithm designed by Rijment and Daemon of
Belgium was declared as the winner of the competition.
• As It met all Security, Cost and Implementation criteria.
• NIST ultimately chose the Rijndael algorithm that is now known as
the Advanced Encryption Standard (AES).
Advanced Encryption Standard (AES)
• AES is an encryption standard chosen by the National Institute of
Standards and Technology(NIST), USA to protect classified information.
• It has been accepted world-wide as a desirable algorithm to encrypt
sensitive data.
• AES, also called Rijndael is a symmetric block cipher that operates on
128-bit blocks.
• It is designed to be used with keys that are 128, 192, or 256 bits long,
yielding ciphers known as AES-128, AES-192, and AES-256.
How Does it work?
E(M,K) D(C,K)
K K
Rijndael S-box
Analysis of Steps
Inverse Substitute Bytes:
For an element {3e} corresponding value is {d1}
Rijndael S-box
Analysis of Steps
Substitute Bytes:
• The S-box is a special lookup table which is constructed by
Galois fields.
• The Generating function used in this algorithm is GF(2^8)
• i.e. 256 values are possible.
• The elements of the sbox are written in hexadecimal
system.
Analysis of Steps
Shift Rows:
• In this step rows, of the block are cylindrically shifted in left direction.
• The first row is untouched, the second by one shift, third by two and
fourth by three.
Analysis of Steps
Inverse Shift Rows:
It performs the circular shifts in the opposite direction (right) for each of
the last three rows, with (first row is untouched), the second by one-byte
circular right shift, third by two and fourth by three.
Analysis of Steps
Mix Columns:
• A good P-box has the property that the output bits of any S-box are
distributed to as many S-box inputs as possible.
• The round key (obtained from the key with some simple operations, for
instance, using S-boxes and P-boxes) is combined using some group
operation, typically XOR.
SP Net : Target
• A single typical S-box or a single P-box alone does not have much
cryptographic strength
• An S-box could be thought of as a substitution cipher, while a P-box could be
thought of as a transposition cipher.
• Confusion means that each binary digit (bit) of the ciphertext should
depend on several parts of the key, obscuring the connections
between the two.
• Shift Rows:
• Avoids the columns being encrypted independently, otherwise AES would
degenerate into four independent block ciphers
• Mix Columns:
• Together with ShiftRows, MixColumns provides diffusion in the cipher.
Attacks on Block Ciphers (like DES,3DES,AES)
• Linear Cryptanalysis:
• General form of cryptanalysis based on finding affine approximations to the
action of a cipher
• Steps:
• Construct linear equations relating plaintext, ciphertext and key bits that
have a high bias; that is, whose probabilities of holding are as close as
possible to 0 or 1
• Use these linear equations in conjunction with known plaintext-ciphertext
pairs to derive key bits.
Attacks on Block Ciphers
• Differential Cryptanalysis:
• It is the study of how differences in information input can affect the resultant
difference at the output
• The attacker then computes the differences of two ciphertexts of two known
plaintexts, hoping to detect statistical patterns in their distribution
• Statistical properties depend upon the nature of the S-boxes used for
encryption
Cryptographic Hash Function
• A cryptographic hash function (CHF) is a mathematical algorithm that maps
data of an arbitrary to a bit array of a fixed size
SHA-256
Second pre- • Given any first input m1, it should be infeasible to find
any distinct second input m2 such that H(m1) = H(m2)
image resistance • Also known as weak collision resistance
at least
The Birthday Paradox
• What number n of people are needed in a room before a shared birthday is
expected among them (i.e., with probability p = 0.5)?
• Ans. Only 23.
• Related Question :
Given n people in a room, what is the probability that two of them have the same
birthday?
• P = 0.71 for n = 30
• P = 0.97 for n = 50
• In security, attackers can often solve problems more efficiently than
expected !
• The “collision” here is not for one pre-specified day (e.g., your birthday);
any matching pair will do
Probability that
no two people
share a birthday
in a group
of n people
Note that the vertical scale is
logarithmic (each step down is
1020 times less likely)
The Birthday
Paradox
The Birthday Paradox Vs Hash Value Collisions
• The process starts with expanding the input message to a length that
is multiple of some fixed number of bits.
• It is necessary because compression function only works on the fixed-
length inputs.
The Merkle-Damgard Construction : How it works?
Step – 2: Calculate n = p * q.
Example, n = p * q = 13 * 11 = 143.
Given That,
RSA Digital Signature Scheme : Proof
𝑷𝒓𝒐𝒐𝒇: 𝑀′ =
The Elgamal Cryptosystem : Secure ???
• The security of this scheme is based on the fact that, without knowing
x, it would be very difficult for an eavesdropper to decrypt the
ciphertext, (a, b).
• Since everyone knows 𝑦 = 𝑔 𝑥 𝑚𝑜𝑑 𝑝, from Bob’s public key, the
security of this scheme is therefore related to the difficulty of solving
the discrete logarithm problem.
• Which is computationally difficult.
• Thus, the security of the Elgamal cryptosystem is based on a difficult
problem from number theory.
The Elgamal Signature Scheme
• In the Elgamal signature scheme, document signatures are done
through randomization, as in Elgamal encryption,
• but the details for Elgamal signatures are quite different from Elgamal
encryption