University of Engineering & Technology, Taxila: Lab Report 2
University of Engineering & Technology, Taxila: Lab Report 2
University of Engineering & Technology, Taxila: Lab Report 2
Technology, Taxila
LAB REPORT 2
Classical Cipher I
Wireless Networks-Lab
(CP-404)
LAB INSTRUCTOR
Dr. Asif Khan
SUBMITTED BY
Hareem Khan
17-CP-29
CODE CODE
function Encryption = function decryption =
Task_1_1(plain_text,key) Task_1_1(Cipher_text,key)
fprintf('Plain Text : %s fprintf('Cipher Text : %s
\n',plain_text) \n',Cipher_text)
fprintf('Key : %d \n',key) fprintf('Key : %d \n',key)
end
fprintf('plain text for key %d is %s \n',key,D_plain_text);
end
end
c) Show the output of your encrypt function (part a) on the following (key, plaintext)
pairs:
• k = 6 plaintext = "Get me a vanilla ice cream, make it a double."
d) Show the output of your decrypt function (part a) on the following (key, ciphertext)
pairs:
• k = 12 ciphertext = 'nduzs ftq buzq oazqe.'
e) Show the output of your attack function (part c) on the following ciphertext, if an
optional
keyword is specified, pass that to your attack function:
• ciphertext = 'baeeq klwosjl osk s esf ozg cfwo lgg emuz.' no keyword
Question # 2: Cryptanalysis of classical cipher
The following examples show a plaintext and its corresponding ciphertext. What do you
think is the key?
1. Plaintext: hello Ciphertext: KHOOR
Here Caesar cipher algorithm is used for encryption that’s why key is same.
for k = 1:length(text)
c_arr{k} = char(text(k));
end
categ_arr = categorical(c_arr);
%G = double(text); %this is histogram of ascii values
freq_analysis = histogram(categ_arr);
xlabel('alphabets');
ylabel('frequency of alphabets');
title('frequency letter analysis');
end
end
c) Use your functions from (a) and (b) to decrypt the following cipher text:"ztmn
pxtne cfa peqef kecnp cjt tmn zcwsenp ontmjsw ztnws tf wsvp xtfwvfefw, c feb
fcwvtf, xtfxevqea vf gvoenwk, cfa aeavxcwea wt wse rntrtpvwvtf wscw cgg lef cne
xnecwea eymcg."