Bda Megh
Bda Megh
BACHELOR OF TECHNOLOGY
SEMESTER VII
Information Technology
Department
CERTIFICATE
This is to certify that
From To
4. Implement Polyalphabetic
cipher encryption-decryption
9. Implement RSA
encryption- decryption
algorithm
10. Demonstrate working of Digital
Signature using Cryptool
Faculty of Engineering & Technology
Practical: 3
The Playfair cipher is a manual symmetric encryption technique and was the first digraph
substitution cipher. It encrypts pairs of letters (digraphs), making it more secure than simple
substitution ciphers.
Program :
import re
def generate_playfair_matrix(key):
key = preprocess_message(key +
'ABCDEFGHIKLMNOPQRSTUVWXYZ') matrix = [] for char in key:
if char not in matrix:
matrix.append(char)
return matrix
i = 0 while i <
len(message):
if i == len(message) - 1:
if decrypted_text[-1] == 'X':
decrypted_text = decrypted_text[:-1]
return ''.join(decrypted_text)
Output :