## Introduction to cryptography

Cryptography, as the name suggests, means “hidden” and means “writing”. It is the method of protecting information and communication with the use of coding. Hence, only those for whom the information is intended can read and process it.

Currently, due to the tremendous growth of networking technologies, an enormous amount of data is being exchanged over the Internet. Therefore, the security of information being conveyed over the Internet is becoming more significant. Sensitive data needs to be transferred securely over the internet while maintaining its confidentiality, integrity, and usability availability.

To maintain the privacy and security of confidential and sensitive information there is a need for approaches that enhances the level of information security. Information hiding is one of the many available approaches which increase the level of information security.

The most powerful and widely used approaches of information hiding used to contravene the threats to information security are Cryptography and Steganography. Cryptography provides security by manipulating the original confidential information so that it is not readable to any intruder and no information can be processed using the encountered encryption.

For this purpose, data undergoes a process to get itself secured by a key on the encryption end. It can be used only when it reaches the decryption key for the retrieval of data. We can gain more clarity using an example. Consider a string “GREEK”. The encryption algorithm gives out a number having the number of digits equal to double the size of the string. The number has alphabetical positions of the last digit first with the process going up to the first letter. The resultant encrypted code will be “1105051807”

## Classic Cryptography

Earlier, cryptography was mainly focused on converting messages into unreadable figures. This was done in order to protect it during the time it was being carried from one place to another. They used digits or letters of the inputs. They were usually symmetric key techniques.

### Polyalphabetic and Monoalphabetic Cipher

#### Monoalphabetic cipher

Monoalphabetic cipher is a substitution cipher. For a given key, the cipher alphabet for each plain alphabet is fixed throughout the

encryption process. For example, if ‘A’ is encrypted as ‘D’, for any number of occurrences in that plaintext, ‘A’ will always get encrypted to ‘D’. These ciphers are highly susceptible to cryptanalysis.

#### Polyalphabetic Cipher

Polyalphabetic cipher is a substitution cipher in which the cipher alphabet for the plain alphabet may be different at different places during

the encryption process.

### Caesar Cipher

It is a mono-alphabetic cipher wherein each letter of the plaintext is substituted by another letter to form the ciphertext. It is the simplest form of substitution cipher scheme. This cryptosystem is generally referred to as the Shift Cipher. The concept is to replace each alphabet with another alphabet which is ‘shifted’ by some fixed number between 0 and 25.

### Playfair Cipher

In Playfair cipher, initially, a key table is created. The key table 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 we need only 25 alphabets instead of 26. If the plaintext contains J, then it is replaced by I.

The sender and the receiver decide on a particular key, say ‘tutorials. In a key table, the first characters (going left to right) in the table is the phrase, excluding the duplicate letters. The rest of the table will be filled with the remaining letters

of the alphabet, in the natural order.

### Vigenere Cipher

This scheme of cipher uses a text string (say, a word) as a key, which is then used for doing a number of shifts on the plaintext. For example, let’s assume the key is ‘point’. Each alphabet of the key is converted to its respective numeric value.

In this case,

p → 16, o → 15, i → 9, n → 14, and t → 20.

Thus, the key is 16 15 9 14 20.

### Transposition Cipher

It is another type of cipher where the order of the alphabets in the plaintext is rearranged to create the ciphertext. The actual plaintext alphabets are not replaced. An example is a ‘simple columnar transposition cipher where the plaintext is written horizontally with a certain alphabet width. Then the ciphertext is read vertically as shown.

For example, the plaintext is “golden statue is in the eleventh cave” and the secret random key chosen is “five”. We arrange this text horizontally in the table with a number of columns equal to the key value. The resulting text is shown below.

**Also Read: THE PROS AND CONS OF 5G NETWORK: ALL ABOUT 5G NETWORK**

## Modern Cryptography

Modern cryptographic practices have been developed to weed out the possible inefficiencies that classic practices brought with them and are more secure and strong against any attempt to mishandle data. Unlike classic cryptography, which used digits and letters of inputs, it operates on binary bit sequences.

It relies on publicly known mathematical algorithms for coding the information. Secrecy is obtained through a secrete key which is used as the seed for the algorithms.

The computational difficulty of algorithms, absence of the secret keys, etc., make it impossible for an attacker to obtain the original information even if he knows the algorithm used for coding. Modern cryptography requires parties interested in secure communication to possess the secret key only.

### Techniques of Cryptography

#### Symmetric Key Cryptography

“It is also called single-key cryptography. It uses a single key. In this encryption process, the receiver and the sender have to agree upon a single secret(shared) key. Given a message (called plaintext) and the key, encryption produces unintelligible data, which is about the same length as the plaintext was. Decryption is the reverse of encryption and uses the same key as encryption.

The process of encryption consists of running a plaintext (input) through an encryption algorithm called a cipher, which in turn generates a ciphertext (output).

While symmetric encryption offers a wide range of benefits, there is one major disadvantage associated with it: the inherent problem of transmitting the keys used to encrypt and decrypt data.

When these keys are shared over an unsecured connection, they are vulnerable to being intercepted by malicious third parties. If an unauthorized user gains access to a particular symmetric key, the security of any data encrypted using that key is compromised.

To solve this problem, many web protocols use a combination of symmetric and asymmetric encryption to establish secure connections. Among the most prominent examples of such a hybrid system is the Transport Layer Security (TLS) cryptographic protocol used to secure large portions of the modern internet.

#### Asymmetric Key Cryptography

Asymmetric key cryptography is also known as Public–key (PK) cryptography introduces a new concept. The idea can be visualized, by making a slot in the safe box so that everyone can deposit a message (like a letterbox). However, only the receiver can open the safe and look at its contents. This concept was proposed by Diffie and Hellman.

Asymmetric encryption uses a mathematically related pair of keys for encryption and decryption: a public key and a private key. If the public key is used for encryption, then the related private key is used for decryption; if the private key is used for encryption, then the related public key is used for decryption.

The two participants in the asymmetric encryption workflow are the sender and the receiver; each has its own pair of public and private keys. First, the sender obtains the receiver’s public key.

Next, the plaintext or ordinary, readable text is encrypted by the sender using the receiver’s public key; this creates ciphertext. The ciphertext is then sent to the receiver, who decrypts the ciphertext with their private key and returns it to legible plaintext.

#### Hash Functions

Hash functions are functions that compress an input of arbitrary length to a result with a fixed length. They were introduced in cryptology in the late seventies as a tool to protect the authenticity of the information.

Soon it became clear that they were a very useful building block to solve other security problems in telecommunication and computer networks. If hash functions satisfy additional requirements, they are a very powerful tool in the design of techniques to protect the authenticity of the information.

Practical applications of cryptographic hash functions include message integrity checking, digital signatures, authentication

procedures and other information security-related applications.

Cryptographic hash functions may be divided into two groups:

- keyed hash functions – require a secret key and are known as message authentication code (MAC),
- un-keyed hash functions – do not require any secret key and may be referred to as manipulation detection code (MDC).

#### Visual Cryptography

Visual cryptography is a cryptographic technique that allows visual information (pictures, text, etc.) to be encrypted in such a way that the decrypted information appears as a visual image.

One of the best-known techniques has been credited to Moni Naor and Adi Shamir, who developed it in 1994. They demonstrated a visual secret sharing scheme, where an image was broken up into n shares so that only someone with all n shares could decrypt the image, while any n − 1 share revealed no information about the original image.

Each share was printed on separate transparency, and decryption was performed by overlaying the shares. When all n shares were overlaid, the original image would appear. There are several generalizations of the basic scheme including k-out-of-n visual cryptography, and using opaque sheets but illuminating them by multiple sets of identical illumination patterns under the recording of only one single-pixel detector.

Pingback: CSS Selectors that you must know - TECH TWERK