There are two primary ways in which a plain text can be modified to obtain cipher text: Substitution Technique and Transposition Technique.
1. Substitution Technique: Substitution technique involves the replacement of the letters by other letters and symbols. In a more straightforward way, the characters of plaintext are replaced, and other substitute characters, numbers and symbols are used at their place.
Types of Substitution Technique:
- Caesar Cipher – In this all characters of plain text is replaced by other characters with same pattern. For example, a replaced with D, B replaced with E.
- Mono Alphabetic Cipher – Major disadvantage of caesar cipher is that all elements are substituted with same technique, it make easy for cryptanalyst to crack it. In Mono Alphabetic Cipher, There is no relation between Substitution of characters. Therefore it makes harder for cryptanalyst to crack it. For example, a can be replaced with B-Z, B can be replaced with A, C-Z.
- Homophonic Substitution Cipher – In this technique, one plain text alphabet can map to more than one cipher text alphabet. This is the best substitution technique with maximum security. For example, a can be replaced with D and E.
- Polygram Substitution Cipher – In this rather than replacing one alphabet, block of alphabet is replaced. For example,
HELLO -------------------> YUQQW
HELL --------------------> TEUI
- Vigenere Cipher –
This technique uses multiple character keys. Each of the keys encrypts one single character. Each character is replaced by a number (A=0, B=1, …Z=25). After all keys are used, they are recycled. For encryption, Formula used : E=(M+K)mod 26
2. Transposition Technique:
In transposition technique, the identity of the characters remains unchanged, but their positions are changed to create the ciphertext.
Types of Transpositional Techniques:
(i) Rail Fence Technique – It uses a simple algorithm:
- Write down plain text message as sequence of diagonals.
- Read the plain text written in step 1 as sequence of rows.
Plain text: come home
c m h m
o e o e
Cipher text : (READ ROW BY ROW) cmhmoeoe
(ii) Simple Columnar Transposition Technique – It uses a simple algorithm:
- Write the plain text message row by row in predefined columns.
- Read the message column by column. It can be in any order.
- Message thus obtained is cipher text message.
Plain text: come niki (suppose we have 4 columns )
C1 C2 C3 C4
c o m e
n i k i
Now we can read in any order of columns. Lets read it by 3 -> 2 -> 4 ->1
Cipher text : mkoieicn
(iii) Vernam Cipher – It uses a simple algorithm:
- Treat each plain text character as a number in the increasing sequence (A=0, B=1, …Z=25).
- Do the same for each character of the key.
- Add each number corresponding to plain text alphabet and key.
- If the sum produced is greater than 26, subtract 26 from it.
- Translate each number of sum back to alphabet, it gives our ciphertext.
Plain text: HOW ARE YOU
Key : NCBTZQARX
H O W A R E Y O U
7 14 22 0 17 4 24 14 20
N C B T Z Q A R X
13 2 1 19 25 16 0 17 23
20 16 23 19 42 20 24 31 43
Subtract 26 if >26: 20 16 23 19 16 20 24 5 17
Cipher text : U Q X T Q U Y F R
Cipher text : UQXTQUYFR
There are many ways to transform plain text into cipher text, but here is a simple example of a Caesar Cipher implementation in Python:
Weakness of each technique,
In the case of Substitution:
- Because it’s based on the substitution of one letter with another based on a translation table. Once the translation table is known, the code is broken.
- Short words, words with repeated patterns, and common initial and final letters all give clues for guessing the pattern of the encryption.
- An encryption algorithm must be regular for it to be algorithmic and for cryptographers to be able to remember it. Unfortunately, the regularity gives clues to the cryptanalyst to break a substitution.
In the case of Transposition:
Just as there are characteristic letter frequencies, there are also characteristic patterns of pairs of adjacent letters, called diagrams (groups of 2 letters) and trigrams (groups of 3 letters). The frequency of appearance of letter groups can be used to match up plaintext letters that have been separated in a ciphertext.
- Security: Transforming plain text to cipher text helps to ensure the security and privacy of the message being transmitted, making it more difficult for unauthorized users to access or read the message.
- Authentication: Cipher text can be used to authenticate the sender of a message, as only someone with the appropriate key can transform the cipher text back into plain text.
- Integrity: Cipher text can be used to verify the integrity of a message, as any changes to the cipher text during transmission will result in an incorrect decryption.
- Versatility: Cipher text can be used in a wide range of applications, from securing online transactions to protecting classified information.
- Complexity: Transforming plain text to cipher text can be a complex process that requires specialized knowledge and expertise.
- Key management: The security of cipher text is dependent on the secrecy and management of the encryption key, which can be a challenge in large-scale systems.
- Compatibility: Cipher text may not be compatible with all systems or applications, which can limit its usability and practicality.
- Processing overhead: The process of transforming plain text to cipher text can require significant computational resources, which can impact system performance.
transforming plain text into cipher text is an important aspect of modern communication. Encryption techniques are essential for protecting sensitive information and ensuring privacy in our increasingly connected world. There are various methods of encryption, including symmetric and asymmetric encryption, as well as hash functions, each with their own strengths and weaknesses. By understanding these techniques, we can better appreciate the role of encryption in modern communication and the importance of keeping our messages secure.
Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation
Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation