Code covered by the BSD License

# Encryption/Coding and Minimzing Data

### Mohammed Siddeq (view profile)

this program used in the Encryption/Coding and Minimize array size at the same.

[EncryptedData,Table]=Encryption_Coding_Minimize_Array_Algorithm(Key1,X)
```function [EncryptedData,Table]=Encryption_Coding_Minimize_Array_Algorithm(Key1,X)
% this function is designed by
% Mohammed M. Siddeq
%date :- 12 - NOV.- 2011
%-----------------------------------
%Encryption / Coding for stream of data depends on the Minimize-Array-Algorithm
% This function is used to convert each 3 data into real number...
% Example\ input :- X=[1 2 -3 200 1 9 2 0 1 3];
%          input :- Key1=[0.1 , 22, 4422];
%           this key is generated according to "0.1" with maximum number ="200"
%           and then add "2" to each key value generated......
%           for more details see  function "Key_generater()"
%output Table=[1 2 -3 200 9 0 3]; %% it is represents Probability of data..(Second Key)
%output EncryptedData=[-13221.9,39840,4422.2,0.3];
% See function "Key_generater()"
% See function "Decryption_Deoding_Minimized_Array_Algorithm()"
% Note\ the data length is unlimited, but for image or signal processing
%       using defualt rangle of the data:- [-255 ... +255] and as a default
%        KEY=[0.1,27.5,7014.5];

% this function is used to find the exact data
% depending on the "Table", is represents probability of data
%input :-  Table
%          Fract   -> 4 - data to be compressed\
%           e=3; % number of data
%output:-  New_arr -> estimated data
%          Sum     -> compressed data

%Table=[0,1,-1,-2,2,3,4,5];
% reduce data to one column
% input matrix
%--------------------------------------------------------------------------
%------------------Compute Table of Symbols ...............................
Table(1)=X(1);
S_AC=size(X);
for jAC=1:S_AC(2)
S_2AC=size(Table);Flag=0;
for kAC=1:S_2AC(2)
if (Table(kAC)==X(jAC))
Flag=1;
end;
end;
if (Flag==0) Table(S_2AC(2)+1)=X(jAC); end;
end;
'Data Encrypted....'% -------------
S_=size(X);
Table=[0,Table]; % add zero on the Table, may be the algorithm need it....
X(S_(2)+1:S_(2)+3)=0; %%% Pad zeros after the last postion in the array....
i=1; L=1;
while (i<=S_(2))

Sum=0;
for j=0:2
Sum=Sum+(X(i+j).*Key1(j+1));
end;
EncryptedData(L)=Sum;
L=L+1;
i=i+3;
end;
end```