Hello, I'm learning how to use python and learning how to encrypt with Vigenere cipher and was wondering if you could help me with this code, i tried but its not doing what i want to. Im using python by the way alphabet = "abcdefghijklmnopqrstuvwxyz0123456789 "
def encVigenere(key, plaintext):
P = len(plaintext)
N = len(key)
for i in range(P):
x = plaintext[i]
y = key[i%N]
ciphertext = plaintext+decIndex(y,x)
return(ciphertext)
def decVigenere(key, ciphertext):
P = len(ciphertext)
N = len(key)
for i in range(P):
x = ciphertext[i]
y = key[i%N]
plaintext = ciphertext + encIndex(y,x)
return(plaintext)
def encIndex(key,plaintext):
f = alphabet.find(key)
g = alphabet.find(plaintext)
p = (f+g) % 37
return alphabet[p]
def decIndex(key,ciphertext):
f = alphabet.find(key)
g = alphabet.find(ciphertext)
p = (g-f+37) % 37
return alphabet[p]
key = "orange"
plaintext = "beware of dogs"
This question was answered on: Sep 21, 2023
Solution~00021147635894.zip (25.37 KB)
This attachment is locked
Our expert Writers have done this assignment before, you can reorder for a fresh, original and plagiarism-free copy and it will be redone much faster (Deadline assured. Flexible pricing. TurnItIn Report provided)
Answered
QUALITYApproved
DATE ANSWEREDSep 21, 2023
EXPERTTutor
ANSWER RATING
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions: