Skip to main content

Cryptography: Encryption and Decryption

 Cryptography

Cryptography involves creating written or generated codes that allow information to be kept secret. Cryptography converts data into a format that is unreadable for an unauthorized user, allowing it to be transmitted without unauthorized entities decoding it back into a readable format, thus compromising the data.
In computer science, cryptography refers to secure information and communication techniques derived from mathematical concepts and a set of rule-based calculations called algorithms to transform messages in ways that are hard to decipher.



 Cryptographic systems are characterized along three independent dimensions: 

1. The type of operations used for transforming plaintext to ciphertext. 
All encryption algorithms are based on two general principles: substitution, in which each element in the plaintext (bit, letter, group of bits or letters) is mapped into another element, and transposition, in which elements in the plaintext are rearranged. The fundamental requirement is that no information be lost (i.e., that all operations are reversible). Most systems, referred to as product systems, involve multiple stages of substitutions and transpositions. 

2. The number of keys used. 
If both sender and receiver use the same key, the system is referred to as symmetric, single-key, secret-key, or conventional encryption. If the sender and receiver use different keys, the system is referred to as asymmetric, two-key, or public-key encryption.

3. The way in which plain text is processed.
 A block cipher processes the input one block of elements at a time, producing an output block for each input block. A stream cipher processes the input elements continuously, producing output one element at a time, as it goes along.

A symmetric encryption scheme has five ingredients:

  • Plaintext:- This is the original intelligible message or data that is fed into the algorithm as input.
  • Encryption Algorithm:- The encryption algorithm performs various substitutions and transformations on the plaintext.
  •  Secret key:- The secret key is also input to the encryption algorithm. The key is a value independent of the plaintext and of the algorithm. The algorithm will produce a different output depending on the specific key being used at the time. The exact substitutions and transformations performed by the algorithm depend on the key.
  •  Ciphertext:- This is the scrambled message produced as output. It depends on the plaintext and the secret key. For a given message, two different keys will produce two different ciphertexts. The ciphertext is an apparently random stream of data and, as it stands, is unintelligible.
  • Decryption algorithm:- This is essentially the encryption algorithm run in reverse. It takes the ciphertext and the secret key and produces the original plaintext.
 

Encryption Techniques: 

 The two basic building blocks of all encryption techniques are:

 1. Substitution Techniques
 2. Transposition Technique

1. A substitution technique is one in which the letters of plaintext are replaced by other letters or by numbers or symbols. If the plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit patterns with ciphertext bit patterns.
 Ex:-  Suppose plaintext is apple . by applying a substitution algorithm we get a cipher text as crrng.
This cipher text is achieved by simply replacing the the alphabets e.g.-    a is replaced by c , p is replaced by r, l by n and e by g. 
Here every alphabets in plaintext is replaced by alphabets that comes after 2 places.
so the Key is 2.
 a =c
 p =r
 p =r
 l =n
 e = g
2. A transposition technique is one in which the letters of plaintext is not only replaced rather their positions are also changed. A very different kind of mapping is achieved by performing some sort of permutation on the plaintext letters. This technique is referred to as a transposition cipher.


Some substitution techniques are as following:
1. Caesar Cipher
2.  Mono-alphabetic Ciphers
3. Play-fair Cipher
4.  Hill Cipher 
5. Poly-alphabetic Ciphers
6. Vernam Cipher




Comments

Popular posts from this blog

Concept of Threads in Computer Programming

Concept of Threads in Computer Programming: Basically Thread is concept of System's OS, That is now being implemented by programmers in various places of application development and testing. What is a Thread? In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system. Multiple threads can exist within one process, executing concurrently and sharing resources such as memory, while different processes do not share these resources.  A process with two threads of execution,  running on one processor     What is a Process? A process is the instance of a computer program that is being executed. It contains the program code and its activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently. A computer program is a passive collec...
  Fibonacci Series in c++:      _________________Flow chart____________________  1. Let 3 variables a, b, sum  2. initialize them as a = 0, b = 1, sum = 0. 3. loop n = 8 times using for loop.  4. if(i==1) print a and skip the loop. 5. if(i==12) print b    skip the loop. Below arrangements explains the scenario:-   n          a [a = b]        b [b = sum]                 sum [sum = a + b]                 3          0                   1                           0 + 1 = 1                2          1                   1         ...