The Traditional Symmetric-Key Ciphers
Define P as the plaintext, C as theciphertext, and K is the key, than:
Encryption: C=Ek(P)
Decryption: P=Dk(C)
In which: Dk(Ek(x))=Ek(Dk(x))=x
The Kerckhoff’s Principle
The resistance of the cipher to attack mustbe based on the secrecy of the key only.
The Cryptanalysis Attacks
Cryptanalysis is the science and art ofbreaking ciphered code, which includes:
1. Ciphertext-only Attack
2. Known-plaintext Attack
3. Chosen-plaintext Attack
4. Chosen-ciphertext Attack
The Substitution Ciphers
A substitution cipher replaces one symbolwith another.
1. Monoalphabetic Substitution Ciphers
In monoalphabetic substitution, therelationship between a symbol in plaintext and ciphertext is always one-to-one.
a. The Additive Cipher (Shift Cipher/CaesarCipher)
Encryption: C = (P + K) mod 26
Decryption: P = (C – K) mod 26
Note that the plaintext, ciphertext and keyare integers in Z26.
b. The Multiplicative Ciphers
Encryption: C = (P * K) mod 26
Decryption: P = (C * K-1) mod 26
Note that the plaintext and ciphertext areinteger in Z26, and the key is an integer in Z26* whichhas only 12 members: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23 and 25.
c. The Affine Ciphers
Encryption: C = (P * K1 +K2)mod 26
Decryption: P = ((C – K2) * K1-1)mod 26
Note that the K1 is from Z26*and the K2 is from Z26. So the size of key domain is26*12=312.
2. Polyalphabetic Substitution Ciphers
In polyalphabetic substitution, therelationship between a symbol in plaintext and ciphertext is one-to-many.
a. Autokey Cipher
P = P1P2P3…
C = C1C2C3…
K = (k1, P1, P2,…)
Encryption: Ci = (Pi+ Ki) mod 26
Decryption: Pi = (Ci –Ki) mod 26
b. Vigenere Cipher
P = P1P2P3…
C = C1C2C3…
K = [(k1, k2, …, km),(k1, k2, …, km), …]
Encryption: Ci = (Pi+ Ki) mod 26
Decryption: Pi = (Ci –Ki) mod 26
c. Hill Cipher
Define K as matrix:
K = [(k11, k12, …, k1m),(k21, k22, …, k2m), …, (km1, km2,…, kmm)]
Encryption: C = PK
Decryption: P = CK-1
Note that P and C are also matrix, and Kand be computed as K = P-1C.
d. One-Time Pad Cipher
Each plaintext symbol is encrypted with akey randomly chosen from key domain. In this cipher, the key has same size asthe plaintext and is chosen completely in random.
The Transposition Ciphers
It does not substitute one symbol for another,but change its location instead.
1. Keyless Transposition Ciphers
a. Rail Fence Cipher: the ciphertext iscreated reading the pattern row by row.
2. Keyed Transposition Ciphers
This method permute the characters by usingwriting plaintext in one way and reading it in another way, and it is done onthe whole plaintext to create the whole ciphertext. Or first divide the wholeplaintext into blocks that has predetermined size, and then permute thecharacter in each block separately with a key.
3. Combining Two Approaches
It combines keyed transposition method andkeyless transposition method into one.
The Stream And Block Ciphers
1.Stream Ciphers
In a stream cipher, encryption anddecryption are done one symbol at a time, like this:
P = P1P2P3;C = C1C2C3; K = (k1, k2,k3, …) then
C1 = Ek1(P1),C2 = Ek2(P2), C3 = Ek3(P3)
2. Block Cipher
In a block cipher, a group of plaintextsymbols are encrypted together to create a group of ciphertext with a singlekey.
In practice, Blocks of plaintext areencrypted individually with a stream of keys. In other word, the cipher isblock cipher when looking at the individual blocks, but a stream cipher whenlooking at the whole message and considering each block as a single unit.