Computer Networks Assignment This lab assignment aims to teach you how to write programs to encrypt and decrypt messages using Vigen`ere Cipher. You can be creative with this project. You are free to...

1 answer below »
NO COPYING OTHER CODE SOURCE ONLINE



Computer Networks Assignment This lab assignment aims to teach you how to write programs to encrypt and decrypt messages using Vigen`ere Cipher. You can be creative with this project. You are free to use C, C++, Java, Python and any language you prefer. You are free to use any machines (PC, UNIX, etc) for your development. In this assignment, you need to write a program that is able to encrypt and decrypt a text file using Vigen`ere Cipher. Your program should take a password and a text file as inputs, then encrypt the file and store encrypted file in your hard drive disk. Your program should also be able to take a password and an encrypted file as inputs, then decrypt the file and store the file in your hard drive disk. Requirements 1. You must write all programs from scratch. Do not use any codes you find online, otherwise, you will get 0 for this assignment. You need to submit a report, the report should include following sections: · Introduction · Design and Implementation of your program · Test: test your program with different password and texts · User manual: detailed instruction on how to use the program Deliverables You need to submit a report You need to submit all the source code in a zip file Grading · Design and Implementation (3) · Test (1) · User manual (1)
Answered Same DayMay 19, 2021

Answer To: Computer Networks Assignment This lab assignment aims to teach you how to write programs to encrypt...

Aditya answered on May 20 2021
161 Votes
Working of code
First the program ask the user for the file name, and the password the password will act as a key for the Vigenere Cip
her. We will store both the file name and password in the local variables in this case name for the fileName and password to store password
filename = input("Enter the file name: ")
password = input("Enter the password: ")
First we will generate the key for the Vigenere Cipher to be used in the program. Key is generated with the help of the password given by the user
key = password * (len(name) // len(password)) + password[:len(name) % len(password)]
Encryption : After taking the input we will first encrypt the code using the Vigenere Cipher
Code:
with open(filename, 'r') as file:
for line in file:
file1 = open("encrypted.txt", "a")
for word in line.split():
key = password * (len(word) // len(password)) + password[:len(word) % len(password)]
text_encrypt = encrypt(word, key)
file1.write(text_encrypt+" ")
file1.write("\n")
file1.close()
print("Data of file have been encrypted to file encrypted.txt");
def new_alph(ch):
ch = ch.lower()
alph = 'abcdefghijklmnopqrstuvwxyz'
new_alph = alph[alph.index(ch):] + alph[:alph.index(ch)]
return new_alph
def encrypt(text, key):
res = ''
alph =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here