encrypt.m

来自「《MATLAB数值计算》最新版本的全部代码Numerical.Computing」· M 代码 · 共 30 行

M
30
字号
function encrypt(filein,fileout)
%ENCRYPT  Apply the CRYPTO function to a text file.
%  ENCRYPT 
%      with no arguments prompts for a input file name.
%  ENCRYPT inputfilename
%      encrypts the text in the input file and displays the results.
%  ENCRYPT inputfilename outputfilename
%      stores the encrypted text in the output file.
% See also CRYPTO.

if nargin < 1
   filein = input('Input file = ','s');
end
fin = fopen(filein);

if nargin == 2
   fout = fopen(fileout,'w');
else
   fout = 1;
end

s = fgetl(fin);
while ischar(s)
   t = crypto(s);
   fprintf(fout,'%s\n',t);
   s = fgetl(fin);
end

fclose all;

⌨️ 快捷键说明

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