# Cryptography in Python: Whenever I learn something, I always try to implement it in a more familiar space, so as to give context to understand it better. In this case, I am implementing concepts from Cryptography into Python to understand it better. For those of you who are familiar with Python, I hope that you can learn a little bit of Cryptography from this article and for those of you who are familiar with Cryptography, I hope you can learn some a Python.

Whenever I learn something, I always try to implement it in a more familiar space, so as to give context to understand it better. In this case, I am implementing concepts from Cryptography into Python to understand it better.

For those of you who are familiar with Python, I hope that you can learn a little bit of Cryptography from this article and for those of you who are familiar with Cryptography, I hope you can learn some a Python. For those who are nor familiar with Python, I envy you as this is the perfect learning opportunity to learn about both at the same time.

## Ciphers:

Ciphers are the backbone of Cryptography, the foundation of how messages can be encoded so as for the true message to be transmitted for those who it was intended to. I find this fascinating because before this, one could have only used physical means to hide information from others.

A cipher functions as so:

``Cipher(Plaintext) = Ciphertext``

The Cipher is a function that encodes the message so that the original text cannot be derived from the Cipher-text directly.

To get from the Ciphertext to the Plaintext:

``Plaintext = Cipher^-1(Ciphertext)``

We have to take the inverse of the Cipher function to reach the original message.Let’s look at one type of cipher:

## Caesar Ciphers:

In a Caesar Cipher, we are shifting the alphabet forward or background by a factor of n.

For example, if n = 1, A becomes B, B becomes C, C becomes D and so on. Let’s construct an algorithm for this.

First we want to create a class for all the ciphers:

``````class ciphers:
def __init__(plaintext):
self.plaintext = plaintext``````

Next we add the Caesar Cipher:

``````def caesar(self,n):
words = self.plaintext.split()
alpha = []
indexes = []
ciphertext = []
letters = string.ascii_letters[:26]
for i in range(len(letters)):
alpha.append(letters[i])
for word in words:
for letter in word:
index = alpha.index(letter)
new_index = index+n
if new_index > len(alpha):
new_index - 26
indexes.append(new_index)
for index in indexes:
ciphertext.append(alpha[index])
ciphertext = ''.join(ciphertext)
return ciphertext``````

## Guide to Python Programming Language

Guide to Python Programming Language

## Generate QR Code using Python — Python Programming — PyShark

This article will explore how to generate QR code in Python and some useful creation features from pyqrcode library. QR codes recently became more popular than ever before, yet few people know that the first iterations of QR codes were created back in 1990s in Japan for the automotive industry.

## Python Programming: A Beginner’s Guide

Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?

## Python Hello World Program - Create & Run Your First Python Program in PyCharm

Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.

## Python Programming Tutorials For Beginners

Python Programming Tutorials For Beginners