Unit 3- Symmetric Key Cryptographic
Algorithms – I
Symmetric Cipher Model
• Symmetric Encryption is the most basic and old method of encryption. It uses only one key for the process of both the
encryption and decryption of data. Thus, it is also known as Single-Key Encryption.
Requirements for Encryption:
There are only two requirements that need to be met to perform encryption. They are,
1. Encryption Algorithm: There is a need for a very strong encryption algorithm that produces cipher texts in such a way that
the attacker should be unable to crack the secret key even if they have access to one or more cipher texts.
2. Secure way to share Secret Key: There must be a secure and robust way to share the secret key between the sender and the
receiver. It should be leakproof so that the attacker cannot access the secret key.
Common Symmetric Encryption Algorithms
1. Data Encryption Standard (DES):
1. An older symmetric-key algorithm with a 56-bit key.
2. Largely considered insecure today due to brute-force attacks.
2. Advanced Encryption Standard (AES):
1. A modern and secure algorithm with key sizes of 128, 192, or 256 bits.
2. Widely used in applications requiring strong security.
3. Blowfish/Twofish:
1. Algorithms designed for high performance and security.
2. Blowfish uses a variable-length key, while Twofish is an advanced version of Blowfish.
4. Triple DES (3DES):
1. An enhancement of DES, applying the encryption process three times for added security.
Applications of Symmetric Cipher Model
• Secure file storage
• Encrypted communications (e.g., SSL/TLS protocols)
• Virtual Private Networks (VPNs)
• Disk encryption (e.g., BitLocker, FileVault)
Cryptography, Cryptanalysis, Brute-Force Attack
• Cryptology has two parts namely, Cryptography which focuses on creating secret codes and Cryptanalysis which is the study of the cryptographic algorithm
and the breaking of those secret codes. The person practicing Cryptanalysis is called a Cryptanalyst. It helps us to better understand the cryptosystems and also
helps us improve the system by finding any weak point and thus work on the algorithm to create a more secure secret code.
• Types of attacks include ciphertext-only attacks, where only encrypted messages are available, known-plaintext attacks, where both plaintext and ciphertext are
known, and chosen-plaintext/ciphertext attacks, where the attacker can encrypt or decrypt specific data to expose the encryption scheme.
• To determine the weak points of a cryptographic system ,it is important to attack the system. This attacks are called Cryptanalytic attacks. The attacks rely on
nature of the algorithm and also knowledge of the general characteristics of the plaintext, i.e., plaintext can be a regular document written in English or it can be
a code written in Java. Therefore, nature of the plaintext should be known before trying to use the attacks.
Types of Cryptanalytic attacks :
• Known-Plaintext Analysis (KPA) : In this type of attack, some plaintext-ciphertext pairs are already known. Attacker maps them in order to find the
encryption key. This attack is easier to use as a lot of information is already available.
• Chosen-Plaintext Analysis (CPA) : In this type of attack, the attacker chooses random plaintexts and obtains the corresponding ciphertexts and tries to find the
encryption key. Its very simple to implement like KPA but the success rate is quite low.
• Ciphertext-Only Analysis (COA) : In this type of attack, only some cipher-text is known and the attacker tries to find the corresponding encryption key and
plaintext. Its the hardest to implement but is the most probable attack as only ciphertext is required.
• Man-In-The-Middle (MITM) attack : In this type of attack, attacker intercepts the message/key between two communicating parties through a secured
channel.
• Adaptive Chosen-Plaintext Analysis (ACPA) : This attack is similar CPA. Here, the attacker requests the cipher texts of additional plaintexts after they have
ciphertexts for some texts.
• Birthday attack: This attack exploits the probability of two or more individuals sharing the same birthday in a group of people. In cryptography, this attack is
used to find collisions in a hash function.
• Side-channel attack: This type of attack is based on information obtained from the physical implementation of the cryptographic system, rather than on
weaknesses in the algorithm itself. Side-channel attacks include timing attacks, power analysis attacks, electromagnetic attacks, and others.
• Brute-force attack: This attack involves trying every possible key until the correct one is found. While this attack is simple to implement, it can be time-
consuming and computationally expensive, especially for longer keys.
• Differential cryptanalysis: This type of attack involves comparing pairs of plaintexts and their corresponding ciphertexts to find patterns in the encryption
Types of Attack Known to Cryptanalyst
1. Ciphertext Only • Encryption Algorithm
• Cipher Text
2. Known Plaintext • Encryption Algorithm
• Cipher Text
• One or more PT-Ct pairs formed with Secret Key
3. Chosen Plain Text • Encryption Algorithm
• Cipher Text
• PT message chosen by cryptanalyst ,together with its CT
generated with the secret key
4. Chosen Cipher Text • Encryption Algorithm
• Cipher Text
• CT Chosen by Cryptanalyst ,together with its
corresponding decrypted PT generated with the Secret
key
5. Chosen Text • Chosen Plaintext and Chosen Cipher Text
Substitution Techniques
• Substitution techniques involve replacing elements of plaintext with corresponding elements of ciphertext based on a predefined rule or
algorithm. They are foundational methods in cryptography and have been used historically in securing communication.
 Classical Encryption Technique :
1. Substitution Technique
2. Transposition Technique
1. CAESAR CIPHER ( FIRST SUBSTITUTION TECHNIQUE)
• Each letter is replaced by other letter or symbols.
• This is the oldest method in Substitution Technique.
• Replacing each letter of the alphabet with the letter standing 3
places further down the alphabet.
Algorithm to convert the Plain text to Encryption :
C= (p , k)mod26 = (p+k)mod26
Algorithm to convert Decryption to Plain text
D=(C,k) mod 26 = (c-k)mod26
Example :
Encrypt the Plaintext “Cyber Security” .
Decrypt the Cipher Text to Plain Text.
2. Monoalphabetic Ciphers
• Monoalphabetic Cipher is a part of the substitution technique in which a single cipher alphabet is used per message (mapping is done from
plain alphabet to cipher alphabet). Monoalphabetic cipher converts plain text into cipher text and re-convert a cipher text to plain text.
Monoalphabetic Cipher eliminates the brute-force techniques for cryptanalysis. Moreover, the cipher line can be a permutation of the 26
alphabetic characters.
• Permutation : A permutation of a finite set of elements “s” is an ordered sequence of all the elements of”s” with each element appearing
exactly one.
Ex: S={x,y,z}(3*2*1) xyz, xzy, yzx, yxz, zxy, zyx (Will try all the poss.way where an element is not repeated again.)
Playfair Cipher
• The Playfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone but was
named after Lord Playfair who promoted the use of the cipher. In playfair cipher unlike traditional cipher we encrypt a pair of
alphabets(digraphs) instead of a single alphabet.
It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the same purpose by the Australians
during World War II. This was because Playfair is reasonably fast to use and requires no special equipment.
• The Playfair Cipher Encryption Algorithm:
The Algorithm consists of 2 steps:
1. Generate the key Square(5×5):
1. The key square is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique and
one letter of the alphabet (usually J) is omitted from the table (as the table can hold only 25 alphabets). If the plaintext contains J, then
it is replaced by I.
2. The initial alphabets in the key square are the unique alphabets of the key in the order in which they appear followed by the remaining
letters of the alphabet in order.
2. Algorithm to encrypt the plain text: The plaintext is split into pairs of two letters (digraphs). If there is an odd number of letters, a Z is
added to the last letter.
1. Generate the key Square(5×5):
• The key square is an 5*5 grid that acts as the key for encrypting the plaintext.
• Each Letter must be unique
• Letter “j/J” is omitted.
• If the plaintext contains J, then it is replaced by “i/I”
Protocols:
1. Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter.
Plain Text: “hello”
After Split: ‘he’ ‘lx’ ‘lo’
• Here ‘x’ is the bogus letter.
2. If the letter is standing alone in the process of pairing, then add an extra bogus letter with the alone letter
• Plain Text: “helloe”
• AfterSplit: ‘he’ ‘lx’ ‘lo’ ‘ez’
• Here ‘z’ is the bogus letter.
• Protocols:
1. Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter.
Plain Text: “hello”
After Split: ‘he’ ‘lx’ ‘lo’
• Here ‘x’ is the bogus letter.
2. If the letter is standing alone in the process of pairing, then add an extra bogus letter with the alone letter
• Plain Text: “helloe”
• AfterSplit: ‘he’ ‘lx’ ‘lo’ ‘ez’
• Here ‘z’ is the bogus letter.
Rules for Encryption:
• If both the letters are in the same column: Take the letter below
each one (going back to the top if at the bottom).
• For example:
• If both the letters are in the same row: Take the letter to the right
of each one (going back to the leftmost if at the rightmost position).
For example:
• If neither of the above rules is true: Form a rectangle with the two
letters and take the letters on the horizontal opposite corner of the
rectangle.
For example:
• For example:
Playfair Cipher- Algorithm Rules for Decryption
• If both the letters are in the same column: Take the letter above
each one (going back to the top if at the bottom).
For example:
• Diagraph : “CL”
Encrypted Text : “me”
C->M
L->E
• Here,we have to go anti-clockwise becoz in encryption we did clock-wise
Hill Cipher
• The Hill cipher was invented by Lester S. Hill in 1929 and is named after him. It is a type of substitution cipher that uses matrices
to encrypt and decrypt messages. The Hill cipher is a polygraphic cipher, meaning that it operates on groups of letters rather than individual
letters. It works by breaking the plaintext message into blocks of a fixed size, usually 2 or 3 letters, and converting each block into a numeric
matrix. After that, the matrix is multiplied by a key matrix to produce the encrypted message, which is also a matrix. The encrypted message
is then converted back into letters to produce the ciphertext.
• The Hill cipher is based on linear algebra and modular arithmetic. In order to use the Hill cipher, the sender and receiver must agree on a key
matrix. The key matrix must be invertible, meaning that it has a matrix inverse. The inverse of a matrix is a matrix that, when multiplied by
the original matrix, produces the identity matrix. The identity matrix is a matrix with ones on the diagonal and zeros elsewhere. The inverse
of a matrix can be calculated using matrix algebra.
• The Hill Algorithm :
Encrypt:
Decryption (Hill Cipher)
Whenever u get
the answer as
“Negative and the
no by mod 26”
-3 + mod 26
(-*+ =+)
Polyalphabetic ciphers
• Polyalphabetic ciphers use multiple alphabets to substitute letters, determining the encryption based on the letter's position in the text. Unlike
basic ciphers, polyalphabetic ciphers create a one-to-many relationship, where each letter has several possible encryptions.
• It utilizes a series of random alphabets for encryption, signified by uppercase letters in the ciphertext that indicate switches between alphabets.
• In this cipher, each ciphertext character is determined by both the plaintext character and its place in the message.
 Transposition Techniques (Single Columnar, Double Columnar)
Rotor Machines
Unit 3 -Symmetric Key Cryptographic Algorithms – I.pptx

Unit 3 -Symmetric Key Cryptographic Algorithms – I.pptx

  • 1.
    Unit 3- SymmetricKey Cryptographic Algorithms – I
  • 2.
    Symmetric Cipher Model •Symmetric Encryption is the most basic and old method of encryption. It uses only one key for the process of both the encryption and decryption of data. Thus, it is also known as Single-Key Encryption.
  • 4.
    Requirements for Encryption: Thereare only two requirements that need to be met to perform encryption. They are, 1. Encryption Algorithm: There is a need for a very strong encryption algorithm that produces cipher texts in such a way that the attacker should be unable to crack the secret key even if they have access to one or more cipher texts. 2. Secure way to share Secret Key: There must be a secure and robust way to share the secret key between the sender and the receiver. It should be leakproof so that the attacker cannot access the secret key.
  • 6.
    Common Symmetric EncryptionAlgorithms 1. Data Encryption Standard (DES): 1. An older symmetric-key algorithm with a 56-bit key. 2. Largely considered insecure today due to brute-force attacks. 2. Advanced Encryption Standard (AES): 1. A modern and secure algorithm with key sizes of 128, 192, or 256 bits. 2. Widely used in applications requiring strong security. 3. Blowfish/Twofish: 1. Algorithms designed for high performance and security. 2. Blowfish uses a variable-length key, while Twofish is an advanced version of Blowfish. 4. Triple DES (3DES): 1. An enhancement of DES, applying the encryption process three times for added security. Applications of Symmetric Cipher Model • Secure file storage • Encrypted communications (e.g., SSL/TLS protocols) • Virtual Private Networks (VPNs) • Disk encryption (e.g., BitLocker, FileVault)
  • 7.
    Cryptography, Cryptanalysis, Brute-ForceAttack • Cryptology has two parts namely, Cryptography which focuses on creating secret codes and Cryptanalysis which is the study of the cryptographic algorithm and the breaking of those secret codes. The person practicing Cryptanalysis is called a Cryptanalyst. It helps us to better understand the cryptosystems and also helps us improve the system by finding any weak point and thus work on the algorithm to create a more secure secret code. • Types of attacks include ciphertext-only attacks, where only encrypted messages are available, known-plaintext attacks, where both plaintext and ciphertext are known, and chosen-plaintext/ciphertext attacks, where the attacker can encrypt or decrypt specific data to expose the encryption scheme. • To determine the weak points of a cryptographic system ,it is important to attack the system. This attacks are called Cryptanalytic attacks. The attacks rely on nature of the algorithm and also knowledge of the general characteristics of the plaintext, i.e., plaintext can be a regular document written in English or it can be a code written in Java. Therefore, nature of the plaintext should be known before trying to use the attacks.
  • 8.
    Types of Cryptanalyticattacks : • Known-Plaintext Analysis (KPA) : In this type of attack, some plaintext-ciphertext pairs are already known. Attacker maps them in order to find the encryption key. This attack is easier to use as a lot of information is already available. • Chosen-Plaintext Analysis (CPA) : In this type of attack, the attacker chooses random plaintexts and obtains the corresponding ciphertexts and tries to find the encryption key. Its very simple to implement like KPA but the success rate is quite low. • Ciphertext-Only Analysis (COA) : In this type of attack, only some cipher-text is known and the attacker tries to find the corresponding encryption key and plaintext. Its the hardest to implement but is the most probable attack as only ciphertext is required. • Man-In-The-Middle (MITM) attack : In this type of attack, attacker intercepts the message/key between two communicating parties through a secured channel. • Adaptive Chosen-Plaintext Analysis (ACPA) : This attack is similar CPA. Here, the attacker requests the cipher texts of additional plaintexts after they have ciphertexts for some texts. • Birthday attack: This attack exploits the probability of two or more individuals sharing the same birthday in a group of people. In cryptography, this attack is used to find collisions in a hash function. • Side-channel attack: This type of attack is based on information obtained from the physical implementation of the cryptographic system, rather than on weaknesses in the algorithm itself. Side-channel attacks include timing attacks, power analysis attacks, electromagnetic attacks, and others. • Brute-force attack: This attack involves trying every possible key until the correct one is found. While this attack is simple to implement, it can be time- consuming and computationally expensive, especially for longer keys. • Differential cryptanalysis: This type of attack involves comparing pairs of plaintexts and their corresponding ciphertexts to find patterns in the encryption
  • 9.
    Types of AttackKnown to Cryptanalyst 1. Ciphertext Only • Encryption Algorithm • Cipher Text 2. Known Plaintext • Encryption Algorithm • Cipher Text • One or more PT-Ct pairs formed with Secret Key 3. Chosen Plain Text • Encryption Algorithm • Cipher Text • PT message chosen by cryptanalyst ,together with its CT generated with the secret key 4. Chosen Cipher Text • Encryption Algorithm • Cipher Text • CT Chosen by Cryptanalyst ,together with its corresponding decrypted PT generated with the Secret key 5. Chosen Text • Chosen Plaintext and Chosen Cipher Text
  • 10.
    Substitution Techniques • Substitutiontechniques involve replacing elements of plaintext with corresponding elements of ciphertext based on a predefined rule or algorithm. They are foundational methods in cryptography and have been used historically in securing communication.  Classical Encryption Technique : 1. Substitution Technique 2. Transposition Technique
  • 11.
    1. CAESAR CIPHER( FIRST SUBSTITUTION TECHNIQUE) • Each letter is replaced by other letter or symbols. • This is the oldest method in Substitution Technique. • Replacing each letter of the alphabet with the letter standing 3 places further down the alphabet. Algorithm to convert the Plain text to Encryption : C= (p , k)mod26 = (p+k)mod26 Algorithm to convert Decryption to Plain text D=(C,k) mod 26 = (c-k)mod26 Example : Encrypt the Plaintext “Cyber Security” . Decrypt the Cipher Text to Plain Text.
  • 12.
    2. Monoalphabetic Ciphers •Monoalphabetic Cipher is a part of the substitution technique in which a single cipher alphabet is used per message (mapping is done from plain alphabet to cipher alphabet). Monoalphabetic cipher converts plain text into cipher text and re-convert a cipher text to plain text. Monoalphabetic Cipher eliminates the brute-force techniques for cryptanalysis. Moreover, the cipher line can be a permutation of the 26 alphabetic characters. • Permutation : A permutation of a finite set of elements “s” is an ordered sequence of all the elements of”s” with each element appearing exactly one. Ex: S={x,y,z}(3*2*1) xyz, xzy, yzx, yxz, zxy, zyx (Will try all the poss.way where an element is not repeated again.)
  • 13.
    Playfair Cipher • ThePlayfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone but was named after Lord Playfair who promoted the use of the cipher. In playfair cipher unlike traditional cipher we encrypt a pair of alphabets(digraphs) instead of a single alphabet. It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the same purpose by the Australians during World War II. This was because Playfair is reasonably fast to use and requires no special equipment. • The Playfair Cipher Encryption Algorithm: The Algorithm consists of 2 steps: 1. Generate the key Square(5×5): 1. The key square is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted from the table (as the table can hold only 25 alphabets). If the plaintext contains J, then it is replaced by I. 2. The initial alphabets in the key square are the unique alphabets of the key in the order in which they appear followed by the remaining letters of the alphabet in order. 2. Algorithm to encrypt the plain text: The plaintext is split into pairs of two letters (digraphs). If there is an odd number of letters, a Z is added to the last letter.
  • 14.
    1. Generate thekey Square(5×5): • The key square is an 5*5 grid that acts as the key for encrypting the plaintext. • Each Letter must be unique • Letter “j/J” is omitted. • If the plaintext contains J, then it is replaced by “i/I” Protocols: 1. Pair cannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter. Plain Text: “hello” After Split: ‘he’ ‘lx’ ‘lo’ • Here ‘x’ is the bogus letter. 2. If the letter is standing alone in the process of pairing, then add an extra bogus letter with the alone letter • Plain Text: “helloe” • AfterSplit: ‘he’ ‘lx’ ‘lo’ ‘ez’ • Here ‘z’ is the bogus letter.
  • 15.
    • Protocols: 1. Paircannot be made with same letter. Break the letter in single and add a bogus letter to the previous letter. Plain Text: “hello” After Split: ‘he’ ‘lx’ ‘lo’ • Here ‘x’ is the bogus letter. 2. If the letter is standing alone in the process of pairing, then add an extra bogus letter with the alone letter • Plain Text: “helloe” • AfterSplit: ‘he’ ‘lx’ ‘lo’ ‘ez’ • Here ‘z’ is the bogus letter.
  • 16.
    Rules for Encryption: •If both the letters are in the same column: Take the letter below each one (going back to the top if at the bottom). • For example:
  • 17.
    • If boththe letters are in the same row: Take the letter to the right of each one (going back to the leftmost if at the rightmost position). For example:
  • 18.
    • If neitherof the above rules is true: Form a rectangle with the two letters and take the letters on the horizontal opposite corner of the rectangle. For example:
  • 19.
  • 20.
    Playfair Cipher- AlgorithmRules for Decryption • If both the letters are in the same column: Take the letter above each one (going back to the top if at the bottom). For example: • Diagraph : “CL” Encrypted Text : “me” C->M L->E
  • 22.
    • Here,we haveto go anti-clockwise becoz in encryption we did clock-wise
  • 23.
    Hill Cipher • TheHill cipher was invented by Lester S. Hill in 1929 and is named after him. It is a type of substitution cipher that uses matrices to encrypt and decrypt messages. The Hill cipher is a polygraphic cipher, meaning that it operates on groups of letters rather than individual letters. It works by breaking the plaintext message into blocks of a fixed size, usually 2 or 3 letters, and converting each block into a numeric matrix. After that, the matrix is multiplied by a key matrix to produce the encrypted message, which is also a matrix. The encrypted message is then converted back into letters to produce the ciphertext. • The Hill cipher is based on linear algebra and modular arithmetic. In order to use the Hill cipher, the sender and receiver must agree on a key matrix. The key matrix must be invertible, meaning that it has a matrix inverse. The inverse of a matrix is a matrix that, when multiplied by the original matrix, produces the identity matrix. The identity matrix is a matrix with ones on the diagonal and zeros elsewhere. The inverse of a matrix can be calculated using matrix algebra. • The Hill Algorithm :
  • 27.
  • 28.
    Decryption (Hill Cipher) Wheneveru get the answer as “Negative and the no by mod 26” -3 + mod 26 (-*+ =+)
  • 29.
    Polyalphabetic ciphers • Polyalphabeticciphers use multiple alphabets to substitute letters, determining the encryption based on the letter's position in the text. Unlike basic ciphers, polyalphabetic ciphers create a one-to-many relationship, where each letter has several possible encryptions. • It utilizes a series of random alphabets for encryption, signified by uppercase letters in the ciphertext that indicate switches between alphabets. • In this cipher, each ciphertext character is determined by both the plaintext character and its place in the message.
  • 42.
     Transposition Techniques(Single Columnar, Double Columnar)
  • 49.