Professional Documents
Culture Documents
ISS Lab 3
ISS Lab 3
Sec: D
Branch: CSE
Reg. No.: 199302019
Date: 02-03-2022
ISS Lab 3
First polygraphic cipher system that was built on the practical system using
more than three symbols or letters in one.
Working:
Choose a key to encrypt the cipher. Input the key and string. If length of string
in n then key length should be n^2.
Generate the Key Square (nxn) from the key. Input all the chars as indices of
the key in the matrix. Let it be Matrix K. If Key Matrix does not have an inverse
i.e |K| == 0 , key cannot be used for decryption.
Generate the Text Matrix (nx1) from the key. Input all the chars as indices of
the plaintext in the matrix. Let it be Matrix P
Let Encrypted Text be Matrix E. Hence it can be found by,
E = ( K x P ) mod 26
Let Decrypted Text be Matrix D. Hence it can be found by,
-1
D = ( K x E ) mod 26
Resultant text can be found by converting the matrix back to text.
Code:
#include <iostream>
#include <math.h>
#include <strings.h>
#define SIZE 50;
int main() {
getKeyMatrix();
encrypt();
decrypt();
return 0;
}
Output: