Playfair Cipher Algorithm
Playfair Cipher Algorithm
It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the
same purpose by the Australians during World War II. This was because Playfair is reasonably fast to use
and requires no special equipment.
Practical # 5
Objective:
Write a program for Play Fair Cipher.
Source Code:
function generatePlayfairTable(key) {
table.push(combinedKey.slice(i * 5, i * 5 + 5).split(''));
return table;
function generateMatrix() {
table.forEach(row => {
row.forEach(cell => {
cellElement.className = 'matrix-cell';
cellElement.textContent = cell;
matrixContainer.appendChild(cellElement);
});
});
function encryptPlayfair() {
NAME: Aaima Faisal Seat No: B21110106001
if (plaintext.length % 2 !== 0) {
plaintext += 'X';
} else {
document.getElementById('output').value = ciphertext;
NAME: Aaima Faisal Seat No: B21110106001
Output:
For Decoding: