Professional Documents
Culture Documents
Information Security Worksheeet 1 20BCS8085
Information Security Worksheeet 1 20BCS8085
INFORMATION SECURITY
WORKSHEET’S
THEORY:-
Caesar Cipher is also known as a shift cipher.
It is a type of symmetric-key cryptography.
It follows the mono-alphabetic cipher, being a part of the substitution cipher.
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DEFGHIJKLMNOPQRSTUVWXYZABC
To encipher a message, simply look up each letter of the message in the "plain"
line and write down the corresponding letter in the "cipher" line. To decipher, do
the reverse.
Plaintext: the quick brown fox jumps over the lazy dog
Cipher text: WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ
CODE:-
#include<bits/stdc++.h>
int main()
intkey,i,length;
int result;
cin>> plain;
cin>>key;
cout<<plain<<endl;
cipher[i]=plain[i] + key;
cout<<cipher[i];
for(i=0;i<length;i++)
plain[i]=cipher[i]-key;
if(isupper(cipher[i])&&(plain[i]<'A'))
plain[i]=plain[i]+26;
if(islower(cipher[i])&&(plain[i]<'a'))
plain[i]=plain[i]+26;
cout<<plain[i];
}
OUTPUT:-
LEARNING OUTCOMES:-
Learnt to code for Caesar Cipher.
Caesar Cipher technique is the simple and easy method of encryption
technique.
It is simple type of substitution cipher.
Each letter of plain text is replaced by a letter with some fixed number of
positions down with alphabet.