**PROJECT VIDEO**

**ABSTRACT**

Voice over Internet protocol has become a popular alternative to public switched telephone network. The flexibility and cost efficiency are the key factors luring enterprises to transition to VoIP. As VoIP technology matures and become increasingly popular so it also gains the attention of the attacker who attacks on the VoIP conversation and wishes to eardrop the conversation. In this paper we first describe the phrase spotting technique used to eavesdrop the conversation and defence approach for eavesdropping attack.

**INTRODUCTION**

Voice over Internet Protocol is a communication protocol and technology that allow user to make phone calls, video conferencing etc using a broadband internet connection instead of analog phone line. Firstly voice signal separated into frames which are stored into data packets and then transported over IP network using communication protocol. VoIP technology has recently become an important part of part of our day to day life; millions of people speak over internet but few of them understand the security issues related to voice communication. While people are not aware of the fact that someone could listen to their VoIP calls. An eavesdropper can detect that specific phrases were used in discussion without ever hearing the actual speech of the user. Phrase spotting Technique used to eavesdrop on VoIP conversation. Phrase spotting technique is harmful to privacy. [1] To make system complete, it would also be rational to implement an encryption scheme based on public key cryptography to transfer the information about the padding length securely.

Cryptography Goals:

- Confidential: The protection of data from unauthorized party and transmitted information is accessible only for reading by authorized parties.
- Authentication: the authentication service is concerned with assuring that a communication is authentic and the assurance that the communicating entity is the one that is claims to be.
- Integrity: assurance that the data received are exactly sent by an authorized entity. Only authorize parties are able to modify and stored information.
- Non repudiation: It prevents either sender or receiver from denying a transmitted message.
- Access Control: It is the ability to limit or control the access to host system and application via communication link.
- Availability: Computer system assets are available to authorized parties when need

**PROPOSED DEFENSE APPROACH FOR EAVESDROPPING **

In this section we present the defence approach for eavesdropping attack. It minimizes the chance of attack on VoIP calls. It would also be rational to implement an encryption scheme based on public key cryptography to transfer the information about the padding length securely [1]. A protection technique in which, padding each packet to different value. So that an attacker would not be able to differentiate between low bit rate and high bit rate. Conversation divides into two parts one side is sender and another side is receiver side. At the sender side firstly sender read an audio file, find out the indexes with low bit rate. For securing the conversation, pad the indexes with low bit rate. We are using 10% value of highest bit rate. Add the random noise at threshold indexes with maximum amplitude of highest bit rate. Then apply Data Encryption Standard [5] to all indexes, for encryption and decryption. Then it encrypts the noisy signal and indexes where noise is added. It is symmetric key where both parties share the same key for en- and decryption. At the receiver side, it decodes the noisy signal and removes the noises from the signal. Then get the original audio file. This technique minimizes the attack.

Transmitter

- Read an audio file.
- Then find out the indexes with low bit rate using a threshold schema.
- For simplicity, we are using 10% value of the highest bit rate.
- Then save the indexes of the signal where thresholding is done.
- Insert the random noise at threshold indexes with maximum amplitude of highest bit rate.
- This is the constant bit rate signal which is to be transfer. Let this signal be A
- And then apply Data Encryption Standard (DES) to all the indexes which were thresholded. Let this signal be B
- Then we get two signals that is A and B. These signals will be transfer through the channel.

Receiver

- Receiver gets two signals. One is DES signal (B) and second is noisy signal (A).
- Decode the DES signal using appropriate key
- The decoded information are the indexes where the random noise is to be remove from the noisy signal
- Remove the noises from the noises signal.
- Then obtain the final audio at the receiver side

**MATLAB SOURCE CODE**

Instructions to run the code

- Copy each of below codes in different M files.
- Place all the files in same folder
- Use files from below link and place in the same folder
- Also note that these codes are not in a particular order. Copy them all and then run the program.
- Run the “final.m” file

**Code 1 – Script M File – final.m**

clear all close all clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % read the audio file=65535 bits disp('Read the audio file') % maximum length [W,Fs,nbits]=read_audio; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % calculate the threshold value disp('Calculate the threshold value') thresh=cal_thresh(W); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % values in between threshold limits T=find(W<=thresh & W>=-thresh); % plot(W) % hold on % plot(W(T),'r') % pause %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % making changes to the input audio disp('Making changes to the input audio') Wnew=changed_audio(W,T); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % plotting new audio and original audio disp('Plotting new audio and original audio') figure subplot(2,1,1) plot(W) %axis([0 length(W) min(W)-0.2 max(W)+0.2]) title('Original audio') subplot(2,1,2) plot(Wnew) %axis([0 length(W) min(W)-0.2 max(W)+0.2]) title('Changed audio') wavwrite(Wnew,Fs,nbits,'reconstructed_audio.wav') % ENCRYPTION PART %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% disp('Encryption part') [Edata,KEY]=encryption(T); % DECRYPTION PART %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% disp('Decryption part') [Tnew,Tnew2]=decryption(Edata,KEY); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Wout=Wnew; Tnew2=Tnew2(1:length(T)); Wout(Tnew2)=thresh; Wout=Wout(1:length(W)); % figure % subplot(3,1,1) figure, plot(W) title('Original audio') % subplot(3,1,2) figure, plot(Wnew) title('Audio with constant bit rate') % subplot(3,1,3) figure, plot(Wout) title('Recovered audio') % plot(T) % hold on % plot(Tnew,'r') % plot(Tnew2,'g') % [PSNR,MSE,MAXERR,L2RAT] = measerr(W,Wout); disp(MSE) wavwrite(Wout,Fs,nbits,'reconstructed_audio.wav') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

**Code 2 – Function M File – encryption.m**

function [Edata,KEY]=encryption(T) n=0; l=mod(length(T),4); for i=1:4:(length(T)-l) plaintext=[fliplr(dec2binvec(T(i),16)) fliplr(dec2binvec(T(i+1),16)) fliplr(dec2binvec(T(i+2),16)) fliplr(dec2binvec(T(i+3),16))]; [ciphertext,key]=DES(plaintext,'ENC'); n=n+1; Edata(n,:)=ciphertext; KEY(n,:)=key; % pause end if l~=0 if l==1 plaintext=[fliplr(dec2bin(T(end),16)) zeros(1,48)]; elseif l==2 plaintext=[fliplr(dec2bin(T(end-1),16)) fliplr(dec2bin(T(end),16)) zeros(1,32)]; elseif l==3 plaintext=[fliplr(dec2bin(T(end-2),16)) fliplr(dec2bin(T(end-1),16)) fliplr(dec2bin(T(end),16)) zeros(1,16)]; end [ciphertext,key]=DES(plaintext,'ENC'); Edata(n+1,:)=ciphertext; KEY(n+1,:)=key; end end

**Code 3 – Function M File – DES.m**

function [varargout] = DES(input64,mode,key) %DES: Data Encryption Standard % Encrypt/Decrypt a 64-bit message using a 64-bit key using the Feistel % Network % ------------------------------------------------------------------------- % Inputs: % input64 = a 64-bit message % mode = either 'ENC' encryption or 'DEC' decryption (default 'ENC') % key = a 56/64-bit key (optional under 'ENC', but mandatory under 'DEC') % Outputs: % varargout{1} = output64, a 64-bit message after encryption/decryption % varargout{2} = a 64-bit key, if a 64-bit key is not provided as an input % ------------------------------------------------------------------------- % Demos: % plaintext = round(rand(1,64)); % [ciphertext,key] = DES(plaintext); % Encryption syntex 1 % [ciphertext1,key] = DES(plaintext,'ENC'); % Encryption syntex 2 % deciphertext1 = DES(ciphertext1,'DEC',key);% Decryption syntex % % key56 = round(rand(1,56)); % [ciphertext2,key64] = DES(plaintext,'ENC',key56);% Encryption syntex 3 (56-bit key) % deciphertext2 = DES(ciphertext2,'DEC',key64); % Decryption syntex (64-bit key) % ciphertext3 = DES(plaintext,'ENC',key64); % Encryption syntex 3 (64-bit key) % deciphertext3 = DES(ciphertext3,'DEC',key56); % Decryption syntex (56-bit key) % % % plot results % subplot(4,2,1),plot(plaintext),ylim([-.5,1.5]),xlim([1,64]),title('plaintext') % subplot(4,2,2),plot(ciphertext),ylim([-.5,1.5]),xlim([1,64]),title('ciphertext') % subplot(4,2,3),plot(deciphertext1),ylim([-.5,1.5]),xlim([1,64]),title('deciphertext1') % subplot(4,2,4),plot(ciphertext1),ylim([-.5,1.5]),xlim([1,64]),title('ciphertext1') % subplot(4,2,5),plot(deciphertext2),ylim([-.5,1.5]),xlim([1,64]),title('deciphertext2') % subplot(4,2,6),plot(ciphertext2),ylim([-.5,1.5]),xlim([1,64]),title('ciphertext2') % subplot(4,2,7),plot(deciphertext3),ylim([-.5,1.5]),xlim([1,64]),title('deciphertext3') % subplot(4,2,8),plot(ciphertext3),ylim([-.5,1.5]),xlim([1,64]),title('ciphertext3') % ------------------------------------------------------------------------- % NOTE: % If a 64-bit key is provided, then its bit parities will be checked. If % a 56-bit key is provided, then it is automatically added 8 partity % checking bits. However, the 8 parity bits are never used in % DES encryption/decryption process. They are included just for the % completeness of a DES implementation. % ------------------------------------------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Functions %% % 1-keyParityCheck(k)----------------to check the parity of the key % 2-HALF_L(message)------------------left half of the message % 3-HALF_R(message)------------------right half of the message % 4-EF = @(halfMessage)--------------32 bit to 48 bit % 5-KM = @(expandedHalfMessage,rK)---xor operation on 48 bit rK and 48 bit expandedHalfMessage % 6-PBOX = @(halfMessage)------------32 bit half message permuted to a 32 bit message % 7-IP = @(message)------------------initial permutation of 64 bits input % 8-FP = @(message)------------------final permutation of 64 bits output % 9-PC1L = @(key64)------------------permutation of left half key (28 bit) % 10-PC1R = @(key64)-----------------permutation of right half key (28 bit) % 11-PC2 = @(key56)------------------second permutation of the 56 bit permuted key before the key mixing operation % 12-KS = @(key28,s)-----------------key shift function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 0. Initialization %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 0.1 check input error(nargchk(1,3,nargin)); % gives error if number of input is less then 1(minargs) and more then 3(maxargs). nargin is the no. of inputs. switch nargin case 1 mode = 'ENC'; % checking the second input parameter (encryption or decryption) K = round(rand(8,7)); % providing a key since no key was entered, this will give only binary values K(:,8) = mod(sum(K,2),2); % note these eight bits of key are never used in encryption % 8th row provided for parity K = reshape(K',1,64); % making the above matrix K(8x8) into K(1,64) varargout{2} = K; % provides key if no key given case 2 switch mode case 'ENC' % checking the second input parameter (encryption or decryption) K = round(rand(8,7));% providing a key since no key was entered, this will give only binary values K(:,8) = mod(sum(K,2),2); % note these eight bits of key are never used in encryption K = reshape(K',1,64); % making the above matrix K(8x8) into K(1,64) varargout{2} = K;% provides key if no key given case 'DEC' % checking the second input parameter (encryption or decryption) error('Key has to be provided in decryption mode (DEC)') otherwise % no mode defined error('WRONG working mode!!! Select either encrtyption mode: ENC or decryption mode: DEC !!!') end case 3 if isempty(setdiff(unique(key),[0,1])) % check provided key type % key only has binary values if numel(key) == 64 % check provided key parity %chk the length of key keyParityCheck = @(k) (sum(mod(sum(reshape(k,8,8)),2))==0); % function to check the parity of the key if keyParityCheck(key) == 1 K = key(:)'; else error('Key parity check FAILED!!!') end elseif numel(key) == 56 % add parity bits % 56 bits added, 8 bit parity will be added K = reshape(key,7,8)';% row vector key will be converted to 2D matrix of dim 7x8 K(:,8) = mod(sum(K,2),2); % note these eight bits of key are never used in encryption %8th row added, K is now 8x8 K = reshape(K',1,64);% 8x8 K is converted into 1x64 K varargout{2} = K; % 2nd output is given display('Key parity bits added') else error('Key has to be either 56 or 64-bit long!!!') end else error('Key has to be binary!!!') end end % 0.2 check message length and type if numel(input64)% == 64 && isempty(setdiff(unique(input64),[0,1])) % checking the input length, it has to be 64 bits P = input64; else error('Message has to be a 64-bit message!!!') end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1. Cryptographical primitives %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1.1 define splitting function HALF_L = @(message) message(1:32); % left half of message HALF_R = @(message) message(33:64); % right half of message % 1.2 define expansion function EF = @(halfMessage) [halfMessage([32,4:4:28])',(reshape(halfMessage,4,8))',halfMessage([5:4:29,1])'];% 32 bit right half message converted into 48 bit message % 1.3 define key mixing (KM) KM = @(expandedHalfMessage,rK) xor(expandedHalfMessage,reshape(rK,6,8)');% xor operation btw 48 bit expanded msg and 48 bit key % 1.4 define eight substitution tables % input: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 st{1} = [14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7;... 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8;... 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0;... 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13]; st{2} = [15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10;... 3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5;... 0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15;... 13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9]; st{3} = [10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8;... 13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1;... 13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7;... 1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12]; st{4} = [7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15;... 13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9;... 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4;... 3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14]; st{5} = [2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9;... 14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6;... 4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14;... 11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3]; st{6} = [12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11;... 10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8;... 9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6;... 4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13]; st{7} = [4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1;... 13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6;... 1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2;... 6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12]; st{8} = [13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7;... 1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2;... 7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8;... 2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % the eight binary s-boxes for i = 1:8 ST{i} = mat2cell(blkproc(st{i},[1,1],@(x) de2bi(x,4,'left-msb')),ones(1,4),ones(1,16)*4); end % 1.5 define subsitution function (SBOX) SUBS = @(expandedHalfMessage,blkNo) ST{blkNo}{bi2de(expandedHalfMessage(blkNo,[1,6]),'left-msb')+1,bi2de(expandedHalfMessage(blkNo,[2:5]),'left-msb')+1}; SBOX = @(expandedHalfMessage) [SUBS(expandedHalfMessage,1);SUBS(expandedHalfMessage,2);... SUBS(expandedHalfMessage,3);SUBS(expandedHalfMessage,4);... SUBS(expandedHalfMessage,5);SUBS(expandedHalfMessage,6);... SUBS(expandedHalfMessage,7);SUBS(expandedHalfMessage,8)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1.6 define permutation function (PBOX) % permute the 32 bit s box output into 32 bit p box output PBOX = @(halfMessage) halfMessage([16 7 20 21 29 12 28 17 ... 1 15 23 26 5 18 31 10 ... 2 8 24 14 32 27 3 9 ... 19 13 30 6 22 11 4 25]); % 1.7 define initial permutation (IP) % permutation od the 64 bit input message, one time operation IP = @(message) message([58 50 42 34 26 18 10 2 ... 60 52 44 36 28 20 12 4 ... 62 54 46 38 30 22 14 6 ... 64 56 48 40 32 24 16 8 ... 57 49 41 33 25 17 9 1 ... 59 51 43 35 27 19 11 3 ... 61 53 45 37 29 21 13 5 ... 63 55 47 39 31 23 15 7]); % 1.8 define final permutation (FP) % final permutation of the output message, one time operation FP = @(message) message([40 8 48 16 56 24 64 32 ... 39 7 47 15 55 23 63 31 ... 38 6 46 14 54 22 62 30 ... 37 5 45 13 53 21 61 29 ... 36 4 44 12 52 20 60 28 ... 35 3 43 11 51 19 59 27 ... 34 2 42 10 50 18 58 26 ... 33 1 41 9 49 17 57 25]); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2. key schedule %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2.1 define permuted choice 1 (PC1) % keeping in mind not to include the parity bits i.e. every 8th bit is % excluded in this operation. PC1L = @(key64) key64([57 49 41 33 25 17 9 ... 1 58 50 42 34 26 18 ... 10 2 59 51 43 35 27 ... 19 11 3 60 52 44 36]); PC1R = @(key64) key64([63 55 47 39 31 23 15 ... 7 62 54 46 38 30 22 ... 14 6 61 53 45 37 29 ... 21 13 5 28 20 12 4]); % 2.2 define permuted choice 2 (PC2) PC2 = @(key56) key56([14 17 11 24 1 5 3 28 ... 15 6 21 10 23 19 12 4 ... 26 8 16 7 27 20 13 2 ... 41 52 31 37 47 55 30 40 ... 51 45 33 48 44 49 39 56 ... 34 53 46 42 50 36 29 32]); % 2.3 define rotations in key-schedule (RK) % round# 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 RK = [1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1];% amount of shifts in the 28 bit half keys before compressiona permutation % 2.4 define key shift function (KS) KS = @(key28,s) [key28(s+1:end),key28(1:s)]; % shifting the 28 bit key according to the iteration in "s" % 2.5 define sub-keys for each round leftHKey = PC1L(K); % 28-bit left half key, 1st permutation operation rightHKey = PC1R(K);% 28-bit right half key, 1st permutation operation for i = 1:16 leftHKey = KS(leftHKey,RK(i)); % shifting the left half key (28 bit) rightHKey = KS(rightHKey,RK(i));% shifting the right half key (28 bit) key56 = [leftHKey ,rightHKey];% concatinating the shifted keys (56 bit) subKeys(i,:) = PC2(key56(:)); % 2nd permutation operation end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 3. DES main loop %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 3.1 initial permutation C = IP(P); % initial permutation of the 64 bit plaintext switch mode case 'ENC' % if encryption, split 64 message to two halves L{1} = HALF_L(C); % left-half 32-bit R{1} = HALF_R(C); % right-half 32-bit case 'DEC' % if decryption, swapping two halves L{1} = HALF_R(C); % right-half 32-bit R{1} = HALF_L(C); % left-half 32-bit end % 3.2 cipher round 1 to 16 for i = 1:16 L{i+1} = R{i}; % half key: 32-bit expended_R = EF(R{i}); % expended half key: 32-bit to 48-bit switch mode case 'ENC' % if encryption, apply sub-keys in the original order mixed_R = KM(expended_R,subKeys(i,:)); % mixed with sub-key: 48-bit case 'DEC' % if decryption, apply sub-keys in the reverse order mixed_R = KM(expended_R,subKeys(16-i+1,:)); % mixed with sub-key: 48-bit end substituted_R = SBOX(mixed_R); % substitution: 48-bit to 32-bit%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% permuted_R = PBOX(reshape(substituted_R',1,32)); % permutation: 32-bit R{i+1} = xor(L{i},permuted_R); % Feistel function: 32-bit end % 3.3 final permutation switch mode case 'ENC' C = [L{end},R{end}]; case 'DEC' C = [R{end},L{end}]; end output64 = FP(C); varargout{1} = output64; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % END %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end

**Code 4 – Function M File – decryption.m**

function [Tnew,Tnew2]=decryption(Edata,KEY) [r c]=size(Edata); Tnew=[]; for j=1:r key=KEY(j,:); ciphertext=Edata(j,:); deciphertext=DES(ciphertext,'DEC',key); Tnew(j,:)=deciphertext; % pause end [r c]=size(Tnew); Tnew2=[]; for i=1:r % Tnew(i,:) Tnew2=[Tnew2 bin2dec(num2str(Tnew(i,1:16))) bin2dec(num2str(Tnew(i,17:32))) bin2dec(num2str(Tnew(i,33:48))) bin2dec(num2str(Tnew(i,49:64)))]; % pause end end

**Code 5 – Function M File – Dec2Bin.m**

function [txt_bin]=Dec2Bin(txt_dec) %converting decimal values into binary Vactor txtb=double(dec2bin(txt_dec,8))-48; txtb=txtb'; txt_bin=(txtb(:))'; end

**Code 6 – Function M File – changed_audio.m**

function Wnew=changed_audio(W,T) m=max(W); op=0; Wnew=W; for i=T a=m; b=m-((10*m)/100); r=a+(b-a).*rand(1,1); if op==0 Wnew(i)=r; op=1; else Wnew(i)=-r; op=0; end end end

**Code 7 – Function M File – cal_thresh.m**

function thresh=cal_thresh(W) p=5; m=max(W); thresh=(p*m)/100;

**Code 8 – Function M File – Bin2Dec.m**

function txt_dec=Bin2Dec(txt_bin) %converting decimal values into binary Vactor m=length(txt_bin); txt_dec=[]; for i=1:m/8 b1=txt_bin(1+(i-1)*8:i*8)+48; b2=bin2dec(char(b1)); txt_dec=[txt_dec b2]; end end

**Code 9 – Function M File – read_audio.m**

function [W,Fs,nbits]=read_audio [W,Fs,nbits]=wavread('def.wav'); W=W'; if length(W)>65535 W=W(1:65535); end % length(W) % W=W(1:1000); %W=wavread('def.wav')'; %W=wavread('mike.wav')'; end