资源简介
md5散列函数,用matlab实现的源代码

代码片段和文件信息
function y = md5( a1 a2 a3 );
%MD5 verifies or generates a signature using the md5 algorithm.
% MD5( M ) or MD5( M 0 ) returns a message digest (signature)
% from the matrix M. Currently the classes double and char are supported.
%
% MD5( M 1 ) generates the digest from a file. M must be a char
% array with the filename/filepath.
%
% You can also give a signature as the last argument. In this case the
% generated signature will be compared against the given. Returns 0 or 1.
% Example: MD5( M 1 ‘7dea362b3fac8e00956a4952a3d4f474‘ );
%
% Md5 is actually not intended to work with large files (> 5 MB see notes)
% but is really comfortable to process directly matlab matrices.
% Notes: o There are more hashing routines that could be implemented
% eg. CRC Adler Haval SHA RMD...
% o There‘s a problem with incremental file reading. As a workaround
% I had to load the whole file into the memory. I tested with a 50 MB
% file but though it worked well I should fix this problem if there‘s
% a need to process large files.
% o For questions/comments/requests: support@treetron.ch.
%
% Credits: I used a freeware library with different hash algorithms. It‘s from
% Alex? (Ritlabs) and was downloaded from Torrys. Thanks a lot.
% Built with Borland Delphi.
%
% License: You may use and distribute md5 free of charge for commercial and
% non-commercial use. Please don‘t modify this notice. Before using this
% routine you have to accept the disclaimer of warranty below.
%
% Warranty: md5 is supplied as is. The author disclaims all warranties
% expressed or implied including without limitation the warranties of
% merchantability and of fitness for any purpose. The author assumes no
% liability for damages direct or consequential which may result from the
% use of md5.
%
% Author: Hans-Peter Suter
% Revision: 0.7
% Date: 25.7.2003
%
% Copyright: Copyright (c) 2003 Treetron GmbH.
% All rights reserved.
if nargin == 3
b1 = a1; % matrix
b2 = a2; % isFile
b3 = a3; % signature
elseif nargin == 2
if isa( a2 ‘char‘ )
b1 = a1;
b2 = 0;
b3 = a2;
else
b1 = a1;
b2 = a2;
b3 = [];
end
elseif nargin == 1
b1 = a1;
b2 = 0;
b3 = [];
else
error( ‘3 arguments required‘ );
end;
% some checks
if ~isempty( b3 )
if ~isa( b3 ‘char‘ )
error( ‘signature must be a char array‘ );
end
if length( b3 ) ~= 32
error( ‘signature must have 32 chars‘ );
end
end
if ~(isa( b1 ‘char‘ ) | isa( b1 ‘double‘ ))
error( ‘value/filename must be a double or char array‘ );
end
if ~(b2 == 0 | b2 == 1)
error( ‘isFile must be 0 or 1‘ );
end
% call dll
if isempty( b3 )
y = md5dll( b1 b2 );
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3041 2003-07-25 23:32 md5.m
文件 176640 2003-07-25 22:46 md5DLL.dll
文件 4590 2003-07-25 23:21 md5test.m
文件 582 2003-07-25 18:18 testfile.txt
- 上一篇:pid运算电路仿真文件Multisim文件
- 下一篇:热力系统计算模型
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论