Need some help doing and writing this project in python.
The purpose of this assignment is to assess your ability to
Research the Vigenere cipher. Write a program that contains an encode and a decode function. The encode function should take a plaintext message and a key. It should return the encoded message. The decode function should take the encoded message and the key and return the decoded message
Need to be done in Python. Thanks
Solution:
Vigenere Cipher:
This is a method of encryption of alphabetic strings of data.
We use a table of alphabets stored as shown below.
The table has alphabets in it stored in 26 rows differently in
each row in which each alphabet is shifted
in each row.

Encryption:
The first letter of plain text is paired with the first letter of key.
We see row and column from table using first letter of plain text as row and first letter of key as column.We use this letter for encrypted text of first letter.
This process repeates for all letters in plain text.
Decryption:
We use the row in the table that corresponds to the key.
The process of decryption is as follows:
We consider the first letter from key(Use it as row value).
We consider the first letter from cipher text and find it in that row.Use that column value as plain text.
We find decryption for that letter.In similar manner we find all the decryptions for all letters.
Another implementation:
In order to eaily implement above cipher method, we convert letters into values ranging 0 to 25.
Encryption:
E=(P+K)mod 26
Where E is encryption
P is plain text,
K is key
Decryption:
D=(E-K+26) mod 26
Program:
def key(s,k): #function to generate key of length equal to
text
k=list(k)
if(len(s)==len(k)): #If equal length return k
return k
else:
for i in range(len(s)-len(k)): #If not equal, then add key in
cyclic manner to generate it of length of s
k.append(k[i%len(k)])
return k
def encode(s,k): #method to encode
s=s.lower() #convert text to lower case
k=key(s,k) #generate key of needed length
str="abcdefghijklmnopqrstuvwxyz"
res=[]
s=list(s)
for i in range(len(s)): #For every character in list
if s[i]==" ":
res.append(" ")
continue #If space, add to result
x=(str.index(s[i])+str.index(k[i]))%26 #get the encrypted letter
and append to list res
res.append(str[x])
res=''.join(res) #convert to string and return res
return res
def decode(s,k): #method to decode the text
s=encode(s,k) #encode the string
s=s.lower()
k=key(s,k) #generate key of needed length
str="abcdefghijklmnopqrstuvwxyz"
res=[]
s=list(s)
for i in range(len(s)): #For every character in s,decode it
if s[i]==" ":
res.append(" ") #If space, add to result
continue
x=(str.index(s[i])-str.index(k[i])+26)%26 #If not space,get
decrypted character and add it to list
res.append(str[x])
res=''.join(res) #convert to string and return it
return res
print(decode("HomeworkLib","code")) #call decode to decrypt text
print(encode("HomeworkLib","code")) #call encode to
encrypt text
Screenshots:
The Screenshots are attached below for reference.
Please follow them proper indentation.



Need some help doing and writing this project in python. The purpose of this assignment is...
WE ARE USING PYTHON TO COMPLETE THIS ASSIGNMENT :) THANK YOU! In this programming assignment, you will write functions to encrypt and decrypt messages using simple substitution ciphers. Your solution MUST include: a function called encode that takes two parameters: key, a 26-character long string that identifies the ciphertext mapping for each letter of the alphabet, in order; plaintext, a string of unspecified length that represents the message to be encoded. encode will return a string representing the ciphertext. a...
Cryptography, the study of secret writing, has been around for a very long time, from simplistic techniques to sophisticated mathematical techniques. No matter what the form however, there are some underlying things that must be done – encrypt the message and decrypt the encoded message. One of the earliest and simplest methods ever used to encrypt and decrypt messages is called the Caesar cipher method, used by Julius Caesar during the Gallic war. According to this method, letters of the...
Write a Python program which implements the following two classical cryptosystem which we covered n class: a) Affine Cipher b) Vigenere Cipher Your program should consist of at least five functions: a) Two functions named encrypt, one for each of the two algorithms which accepts a lowercase alphabetical plaintext string and key as input and outputs a corresponding cipher text string. b) Two functions named decrypt, one for each of the two algorithms which accepts a lowercase alphabetical ciphertext string...
Can someone please help me for this assignment? Cryptography — the science of secret writing — is an old science; the first recorded use was well before 1900 B.C. An Egyptian writer used previously unknown hieroglyphs in an inscription. We will use a simple substitution cypher called rot13 to encode and decode our secret messages. ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in...
Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program is required that allows a user to encode text using any of three possible ciphers. The three ciphers you are to offer are: Caesar, Playfair and Columnar Transposition. • The program needs to loop, repeating to ask the user if they wish to play with Caesar, Playfair or Columnar Transposition until the user wishes to stop the program. •For encoding, the program needs to...
Do this using the C language. show me the code being executed
and also copy and paste the code so i can try it out for
myseld
Instructions A cipher is mirrored algorithm that allow phrases or messages to be obfuscated (ie. "scrambled"). Ciphers were an early form of security used to send hidden messages from one party to another. The most famous and classic example of a cipher is the Caesar Cipher. This cypher worked by shifting each letter...
Question) Write a decryption function decryp_scytale(ctext, key) in PYTHON that would decrypt any ciphertext produced through the scytale cipher scheme using a given key. Note: the key refers to the diameter of the rod. It represents the number of characters which can be written in the one of the rounds around the rod (think of number of rows in a table). Also, remember that it is assumed that the rod can have an infinite length, i.e. there is no limit...
In C++ Having heard you have gotten really good at programming, your friend has come to ask for your help with a simple task. She would like you to implement a program to encrypt the messages she exchanges with her friends. The idea is very simple. Every letter of the alphabet will be substituted with some other letter according to a given key pattern like the one below. "abcdefghijklmnopqrstuvwxyz" "doxrhvauspntbcmqlfgwijezky" // key pattern For example, every 'a' will become a...
LANGUAGE: PYTHON
Write a function called: d_polybius(). The
function applies the decryption scheme for the polybius cipher
scheme above. The start of the function call the
get_polybius_square function to get the square as a
string.
The second scenario when the number of characters is not even,
excluding ‘\n’. For instance: “71\n5” is an invalid cipher because
there is no way that the last number correspond to a character (we
need two numbers).
A customized version of Polybius square will be...
This is my assignment prompt
This is an example of the
input and output
This is what I have so far
What is the 3rd ToDo in the main.cpp for
open the files and read the encrypted message? Does the rest of the
code look accurate?
Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a...