(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
Answered
QUALITY
Approved
ANSWER RATING

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)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 21, 2023

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP

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:

  • ■ As a reference for in-depth understanding of the subject.
  • ■ As a source of ideas / reasoning for your own research (if properly referenced)
  • ■ For editing and paraphrasing.

This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

Get Free Price Quote