Professional Documents
Culture Documents
PART B
(PART B: TO BE COMPLETED BY STUDENTS)
if len(string) == len(key):
return(key)
else:
for i in range(len(string) - len(key)):key.append(key[i % len(key)])
return("" . join(key))
for i in range(len(string)):
x = (ord(string[i]) + ord(key[i])) % 26x
+= ord('A') cipher_text.append(chr(x))return("" .
join(cipher_text))
for i in range(len(cipher_text)):
x = (ord(cipher_text[i]) - ord(key[i]) + 26) % 26x
+= ord('A') orig_text.append(chr(x))
return("" . join(orig_text))
Output:
B.3 Conclusion:
In this experiment we studied Different types of ciphers and implemented one of them in thisexperiment – Vignere
Cipher.
Ans. Under different alphabets, the same plain text character is thus encrypted to different cipher text characters,
preventing simple frequency analysis as per monoalphabetic substitution. Therefore, polyalphabetic cipher
techniques make the message more secure as compared to various other techniques. In monoalphabetic
substitution, the relationship between a character in the plain text to a character in the cipher text is always one-to-
one. In polyalphabetic substitution, each occurrence of a character may have a different substitute. The relationship
between a character in the plain text to a character in the cipher text is one-to-many.