Week 2 Crypto
Week 2 Crypto
Hill Cipher
Key Generation:
• The key in the Hill cipher is a square matrix, often denoted as K.
• The size of the matrix (n × n) determines the block size for encryption.
• The key matrix should be invertible, meaning its determinant must be non-zero, and its
inverse should exist in modular arithmetic.
Encryption:
• Each block of plaintext is multiplied by the key matrix modulo some fixed number (usually
the size of the alphabet or the size of the finite field).
Mathematically, if P is the plaintext block vector and C is the ciphertext block vector, and K is
the key matrix, encryption is done as follows:
C =K ·P (mod 26)
Decryption:
• To decrypt, the ciphertext block is multiplied by the modular inverse of the key matrix.
Mathematically, if P ′ is the original plaintext block vector and C ′ is the decrypted ciphertext block
vector:
P ′ = K −1 · C ′ (mod 26)
Here, K −1 is the modular inverse of the key matrix.
• Block Cipher
1
• Stream Ciper
Block Cipher
A block cipher is a symmetric key cryptographic algorithm that operates on fixed-size blocks
of data. It encrypts or decrypts the data in blocks, typically of fixed length, and uses a secret key
for the transformation. Each block is treated independently during the encryption or decryption
process.
• The encryption function E transforms the plaintext block using the key.
Decryption:
• Let C be the ciphertext block.
• The decryption function D transforms the ciphertext block back to the original plaintext
block.
Product Cipher
A product cipher is a type of symmetric-key cipher that combines multiple transformations
(substitution and permutation) to achieve higher security. It is constructed by applying two or
more simple ciphers in sequence or in parallel. The idea behind a product cipher is to overcome
the weaknesses of individual ciphers and provide a more robust and secure encryption scheme.
2
Figure 1: Substitution-Permutation Network (SPN)
The function f operates on two inputs of length n and produces an output of length n.
For encryption, L1 = R0 and R1 = L0 ⊕ f (R0 , k).
For decryption, L0 = R1 and R0 = L1 ⊕ f (L1 , k).
Iterated Block Cipher
An Iterated Block Cipher repeats a round function for a specified number of rounds (r). It
involves a block size n, a key size, and the generation of subkeys.
For a 2-round iterated block cipher, the encryption involves f (k, p) ⇒ C1 ⇒ f (k2 , C1 ). The
decryption involves G(k) ⇒ k1 , k2 and C = f −1 (C, k2 ) ⇒ f −1 (C1 , k1 ).
Data Encryption Standard (DES)
3
Designed by IBM, DES uses a 64-bit secret key and operates on 64-bit plaintext blocks. The
key has parity check bits.
DES is based on the Feistel Network, is an iterated block cipher with 16 rounds, and uses key
scheduling to generate 48-bit subkeys.
4
Figure 4: DES Key Scheduling