📄 md5.m
字号:
function a=md5(varargin)
% USAGE
% a=md5(varargin)
%
% where the arguements are filenames.
% If only one filename is specified (if number of input arguements is 1),
% the MD5 sum of the file is returned
% If two filenames are specified (if number of input arguements is 2),
% the MD5 sum of the two files are compared and
% 1 is returned if they are the same
% 0 is returned if they are different
%
% This program needs MD5 Utility
% This can be got from http://www.fourmilab.ch/md5/
% and lots of other sites, but parameters might be different
% for other versions. This program uses the md5.exe downloaded
% from the above site.
%
% NOTE: Change md5path (line 24) in this program to the path where md5.exe is present
%Suresh E Joel, May 12,2003
md5path='D:\users\sejoel\matlab\md5\';
switch(nargin)
case 0,
error('Too few arguements for MD5');
case 1
s=sprintf('%c%s%s\t%s\n','!',md5path,'md5.exe -n -otempmd5.txt',varargin{1});
eval(s);
a=textread('tempmd5.txt','%s');
case 2
s=sprintf('%c%s%s\t%s\n','!',md5path,'md5.exe -n -otempmd5.txt',varargin{1});
eval(s);
a=textread('tempmd5.txt','%s');
s=sprintf('%c%s%s\t%s\n','!',md5path,'md5.exe -n -otempmd5.txt',varargin{2});
eval(s);
b=textread('tempmd5.txt','%s');
a=strcmp(a,b);
otherwise
error('Too many arguements for MD5');
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -