(Solution) alphabet = "abcdefghijklmnopqrstuvwxyz0123456789 " def encVigenere(key, plaintext): P = len(plaintext) N = len(key) for i in... > Snapessays.com

(Solution) alphabet = "abcdefghijklmnopqrstuvwxyz0123456789 " def encVigenere(key, plaintext): P = len(plaintext) N = len(key) for i in...

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"

Solution details:
STATUS
QUALITY
Approved

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)

STATUS

QUALITY

Approved

Sep 21, 2023

EXPERT

Tutor