Beginner Guide to Classic Cryptography

Cryptography:  It is a technique of scrambling messages using mathematical logic to keep the information secure. It preserves the scrambled message from being hacked when transported over the unsecured network. Since it converts the readable message in unreadable text. Plaintext: It is the content of data which is in a readable form that needs to be shared over the insecure network. Encrypting key: It is a random string of bits created particularly to scramble the plaintext information into unreadable text using mathematical logic. There are two types of encryption keys symmetric key and asymmetric key. Ciphertext: The output of encryption produces ciphertext which is not readable by human beings. Decrypting key: It is the key which used to decipher the ciphertext into again plaintext using the symmetric or asymmetric key to read the original message. Functionality of cryptosystem Authentication: It is the process of verification of the identity of a valid person through his username and password that communicates over a network. Authorization: It refers to the process of granting or denying access to a network resource or service. Most of the computer security systems that we have today are based on a two-step mechanism. The first step is authentication, and the second step is authorization or access control, which allows the user to access various resources based on the user’s identity. Confidentiality or privacy: It means the assurance that only authorized users can read or use confidential information. When cryptographic keys are used on plaintext to create ciphertext, privacy is assigned to the information. Integrity: Integrity is the security aspect that confirms that the original contents of information have not been altered or corrupted. There should be no kind of modification with information while it is transported over the network. Non-repudiation: Non-repudiation makes sure that each party is liable for its sent message. Someone can communicate and then later either falsely deny the communication entirely or claim that it occurred at a different time or even deny receiving any piece of information. Classical Cryptographic Algorithms Types Caesar Cipher Caesar cypher is a type of substitution cypher in which each letter of the alphabet is swapped by a letter a certain distance away from that letter. Algorithm Step 0: Mathematically, map the letters to numbers (i.e., A = 1, B = 2, and so on). Step 1: Select an integer key K between 1 and 25 (i.e., there are a total of 26 letters in the English language) let’s say shift right to 3 alphabets where A +3 = D, B+3 = E and so on. Step 2: The encryption formula is “Add k mod 26”; that is, the original letter L becomes (L + k)%26. For example encryption of “IGNITE” will like as: C = E (L+K) %26 Here L= I and K = 3 C = E (I+3) % 26 C = E (9+3) % 26 C = E (12) % 26 C = E (L) Hence encryption of IGNITE: LJQLWH Step 3: The deciphering is “Subtract k mod 26”; that is, the encrypted letter L becomes (L – k) %26. For example Decryption of “LJQLWH” will like as: C = D (L-K) %26 C = D (L-3) % 26 C = D (12-3) % 26 C = D (9) % 26 C = D (I) Hence decryption of LJQLWH: IGNITE  Limitation: Caesar cypher is vulnerable to brute-force attack because it depends on a single key with 25 possible values if the plaintext is written in English. Consequently, by trying each option and checking which one results in a meaningful word, it is possible to find out the key. Once the key is found, the full ciphertext can be deciphered accurately. Monoalphabetic Cipher It is also a type of substitution cipher in which each letter of the alphabet is swapped by using some permutation of the letters in an alphabet. Hence permutations of 26 letters will be 26! (Factorial of 26) and that is equal to 4×1026. This technique uses a random key for every single letter for encryption and which makes the monoalphabetic cipher secure against brute-force attack. The sender and the receiver decide on a randomly selected permutation of the letters of the alphabet. For example in word “HACKING” replace G from “J” and N from “W” hence permutation key is 2! i.e. factorial of 2 and HACKING will become “HACKJIW”. Algorithm Step 0: Generate plaintext–cypher text pair by mapping each plain text letter to a different random cipher text letter IJKLQR——–GFE. Step 1: To encipher, for each letter in the original text, replace the plain text letter with a ciphertext letter. Hence encryption of “IGNITE” will be as shown below Step 2: For deciphering, reverse the procedure in step 1. Hence decryption of “USBUOQ” will be “IGNITE” Limitations Despite its advantages, the random key for each letter in monoalphabetic substitution has some downsides too. It is very difficult to remember the order of the letters in the key, and therefore, it takes a lot of time and effort to encipher or decipher the text manually. Monoalphabetic substitution is vulnerable to frequency analysis. Playfair Cipher  It encrypts digraphs or pairs of letters rather than single letters like the plain substitution cipher In this cipher, a table of the alphabet is 5×5 grids is created which contain 25 letters instead of 26. One alphabet “J” (or any other) is omitted. One would first fill in the spaces in the table with the letters of the keyword (dropping any duplicate letters), then fill the remaining spaces with the rest of the letters of the alphabet in order. If the plaintext () contains J, then it is replaced by I. Algorithm Step 0: Split the plaintext into a pair, if the number of letters is odd then add “X” with the last letter of the plaintext For example “TABLE” is our plaintext split it into the pair as TA BL EX Step 1: Set the 5 × 5 matrices by filling the first positions with the key. Fill the rest of the matrix with other letters. Let’s assume “ARTI” is our key for encryption. Step

Read More