Home

Cryptography with Python Tutorial PDF Version Quick Guide Resources Job Search Discussion Modern cryptography is the one used widely among computer science projects to secure the data messages. This tutorial covers the basic concepts of cryptography and its implementation in Python scripting language. After completing this tutorial, you will be able to relate the basic techniques of cryptography in real world scenarios. Audience This tutorial is meant for the end users who aspire to learn the basics of cryptography and its implementation in real world projects. This tutorial is also useful for networking professionals as well as hackers who want to implement new frameworks instead of following a traditional approach. Prerequisites Throughout this tutorial, you will learn the basics of cryptography, algorithm description and its implementation in Python. This tutorial is designed with an assumption that the user has an understanding on the basics of cryptography and algorithms. If you are a beginner to these topics, we suggest you to go through tutorials related to them, before you start with this tutorial. Print Page Previous Next Advertisements ”;

Overview

Cryptography with Python – Overview ”; Previous Next Cryptography is the art of communication between two users via coded messages. The science of cryptography emerged with the basic motive of providing security to the confidential messages transferred from one party to another. Cryptography is defined as the art and science of concealing the message to introduce privacy and secrecy as recognized in information security. Terminologies of Cryptography The frequently used terms in cryptography are explained here − Plain Text The plain text message is the text which is readable and can be understood by all users. The plain text is the message which undergoes cryptography. Cipher Text Cipher text is the message obtained after applying cryptography on plain text. Encryption The process of converting plain text to cipher text is called encryption. It is also called as encoding. Decryption The process of converting cipher text to plain text is called decryption. It is also termed as decoding. The diagram given below shows an illustration of the complete process of cryptography − Characteristics of Modern Cryptography The basic characteristics of modern cryptography are as follows − It operates on bit sequences. It uses mathematical algorithms for securing the information. It requires parties interested in secure communication channel to achieve privacy. Print Page Previous Next Advertisements ”;

Understanding Vignere Cipher

Understanding Vignere Cipher ”; Previous Next Vignere Cipher includes a twist with Caesar Cipher algorithm used for encryption and decryption. Vignere Cipher works similar to Caesar Cipher algorithm with only one major distinction: Caesar Cipher includes algorithm for one-character shift, whereas Vignere Cipher includes key with multiple alphabets shift. Mathematical Equation For encryption the mathematical equation is as follows − $$E_{k}left ( M{_{i{}}} right ) = left ( M_{i}+K_{i} right );;; mod ;; 26$$ For decryption the mathematical equation is as follows − $$D_{k}left ( C{_{i{}}} right ) = left ( C_{i}-K_{i} right );;; mod ;; 26$$ Vignere cipher uses more than one set of substitutions, and hence it is also referred as polyalphabetic cipher. Vignere Cipher will use a letter key instead of a numeric key representation: Letter A will be used for key 0, letter B for key 1 and so on. Numbers of the letters before and after encryption process is shown below − The possible combination of number of possible keys based on Vignere key length is given as follows, which gives the result of how secure is Vignere Cipher Algorithm − Vignere Tableau The tableau used for Vignere cipher is as shown below − Print Page Previous Next Advertisements ”;

Reverse Cipher

Cryptography with Python – Reverse Cipher ”; Previous Next The previous chapter gave you an overview of installation of Python on your local computer. In this chapter you will learn in detail about reverse cipher and its coding. Algorithm of Reverse Cipher The algorithm of reverse cipher holds the following features − Reverse Cipher uses a pattern of reversing the string of plain text to convert as cipher text. The process of encryption and decryption is same. To decrypt cipher text, the user simply needs to reverse the cipher text to get the plain text. Drawback The major drawback of reverse cipher is that it is very weak. A hacker can easily break the cipher text to get the original message. Hence, reverse cipher is not considered as good option to maintain secure communication channel,. Example Consider an example where the statement This is program to explain reverse cipher is to be implemented with reverse cipher algorithm. The following python code uses the algorithm to obtain the output. message = ”This is program to explain reverse cipher.” translated = ”” #cipher text is stored in this variable i = len(message) – 1 while i >= 0: translated = translated + message[i] i = i – 1 print(“The cipher text is : “, translated) Output You can see the reversed text, that is the output as shown in the following image − Explanation Plain text is stored in the variable message and the translated variable is used to store the cipher text created. The length of plain text is calculated using for loop and with help of index number. The characters are stored in cipher text variable translated which is printed in the last line. Print Page Previous Next Advertisements ”;