⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arc4.m

📁 有关OFDM信道估计的matlab程序(其中包含英文简介和部分simulink模型)
💻 M
字号:
%Initialize the secret key
MyKey(1)=164;
MyKey(2)=4;
MyKey(3)=24;
MyKey(4)=107;
MyKey(5)=251;
MyKey(6)=66;
MyKey(7)=186;
MyKey(8)=95;
%Initialize data 
data=round(rand(1,300)*256);
%Creat an array of size 256 filled with numbers from 0 to 255.
for i=1:256
     S(i)=i-1;
end
% Creat another array of size 256 filled with repetions of the key. 
for i=0:255
     K(i+1)=MyKey(mod(i,length(MyKey))+1);
end
% Initialize the order of S accoding to the secret key.
j=0;
for i=0:255
     j=mod(j+S(i+1)+K(i+1),256);
     temp=S(i+1);
     S(i+1)=S(j+1);
     S(j+1)=temp;
end
% The encrypted data is generated one byte at a time. 
i=0;
j=0;
for k=1: length(data)
     i=mod(i+1, 256);
     j=mod(j+S(i+1), 256);
     temp=S(i+1);
     S(i+1)=S(j+1);
     S(j+1)=temp;
     t=mod(S(i+1)+S(j+1),256);
     PS=S(t+1);
     edata(k)=bitxor(data(k),PS);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -