3.0 Project Functionality .1 Overview The primary objective of this project is t
ID: 3888397 • Letter: 3
Question
3.0 Project Functionality .1 Overview The primary objective of this project is to increase your implementation of Vigenere Cipher. You have to design and develop a C/CPP/JAVA -based program to encrypt any given message based on the Vig used as the cipher key. You also have to skip the space between the words, while replicating the key to cover the entire message. You can find an example of how the below message has been encrypted using my last name as the cipher key understanding of the fundamental nere algorithm. Your last name must be A HEALTHY ATTITUDE IS CONTAGIOUS BUT DONT WAIT TO CATCH IT FROM OTHERS +mod 26) K HOSHAVI KHOSHAVI KH OSHAVIKHOS HAV IKHO SHAV IK HOSHA VI KHOS HAVIKH L PTTTUDH LBIBBVZN TA RHVUWPTWIL JVP MZVI PUP CZ KPMKI EC QZDF WUDNCA. 3.2 Test Cases The following messages will be given as the input as the test case to your program to check the accuracy of your program A HEALTHY ATTITUDE IS CONTAGIOUS BUT DONT WAIT TO CATCH IT FROM OTHERS. -IF YOU CARRY YOUR CHILDHOOD WITH YOU YOU NEVER BECOME OLDER. FROM PRINCIPLES IS DERIVED PROBABILITY BUT TRUTH OR CERTAINTY IS OBTAINED ONLY FROM FACTS 4.0 Program Code Evaluation 4.1 Evaluation Method Project Code scores will be evaluated by entering aforementioned "stress-test" sentences. Any missing, incorrect, or extra unspecified functionality wll resl in a proportional or complete deduction of credit 4.2 Operational Code Required Any compiler errors (e.g. gcc or javac is unable to compile the program code), as well as program runtime failures or infinite loops will result no credit for affected parts of the Program Code for this Project. Please verify that your submission is operational prior to final submission 4.3 Individual Work The entire submission of Program Code and Project Report shall be your own individual original work. Any unauthorized use of shared, jointly written, or re-used code results in no credit for the entire ProjectExplanation / Answer
As mention in posted question, implemented the logic in python using "sparbel" as the cipher key and taking message as input from keyboard :
#Creates the base Alphabet which will be used for finding preceeding characters from the given message.
alphabets = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
givenMessage = raw_input("Please enter the message ")
key = "sparbel"
keyList = []
keyLength = 0
while keyLength < len(givenMessage):
#Adds the user given key into a list character by character.
#Also makes the key the same length as givenMessage
for character in key:
if keyLength < len(givenMessage):
keyList.append(str(character))
keyLength = keyLength + 1
#The variable each processed letter is appended to
finalCipherText = []
#This is the value used to temporaily store the ciphertext character during the iteration
cipherCharIndexValue = 0
keyIncrement = 0
#iterates through the plain text
for plainTextChar in givenMessage:
#Adds the base alphabets index value of the key and the plain text char
cipherCharIndexValue = alphabets.index(keyList[keyIncrement]) + alphabets.index(plainTextChar)
while cipherCharIndexValue > 25:
#makes the addition value under 26 as to not go out of range of base alphabet tuple
cipherCharIndexValue = cipherCharIndexValue - 26
#appends the ciphertext character to the finalCipherText variable.
#The character is the index of the key + index of the plainTextChar from baseAlphabets
finalCipherText.append(alphabets[cipherCharIndexValue])
#Moves onto the next key
keyIncrement = keyIncrement + 1
print ''.join(finalCipherText)#Makes the result a strings for printing to the console.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.