MD5 computes an MD5 checksum from an analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MD5 computes an MD5 checksum from an analysis objects. CALL: h = md5(a) INPUTS: a - input analysis object OUTPUTS: h - md5 hash VERSION: $Id: md5.m,v 1.5 2008/02/19 19:45:58 hewitson Exp $ HISTORY: 15-09-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function h = md5(varargin) 0002 % MD5 computes an MD5 checksum from an analysis objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: MD5 computes an MD5 checksum from an analysis objects. 0007 % 0008 % CALL: h = md5(a) 0009 % 0010 % INPUTS: a - input analysis object 0011 % 0012 % OUTPUTS: h - md5 hash 0013 % 0014 % VERSION: $Id: md5.m,v 1.5 2008/02/19 19:45:58 hewitson Exp $ 0015 % 0016 % HISTORY: 15-09-2007 M Hewitson 0017 % Creation 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 VERSION = '$Id: md5.m,v 1.5 2008/02/19 19:45:58 hewitson Exp $'; 0022 CATEGORY = 'Helper'; 0023 0024 %% 'Params', 'Version', 'Category' Call 0025 if nargin == 2 0026 if isa(varargin{1}, 'ao') && strcmp(varargin{2}, 'Params') 0027 h = plist(); 0028 return 0029 elseif isa(varargin{1}, 'ao') && strcmp(varargin{2}, 'Version') 0030 h = VERSION; 0031 return 0032 elseif isa(varargin{1}, 'ao') && strcmp(varargin{2}, 'Category') 0033 h = CATEGORY; 0034 return 0035 end 0036 end 0037 0038 as = []; 0039 for j=1:nargin 0040 if isa(varargin{j}, 'ao') 0041 as = [as varargin{j}]; 0042 end 0043 end 0044 0045 h = {}; 0046 0047 for ii = 1:numel(as) 0048 %%%%%%%%%%% Convert object to XML 0049 % make pointer to xml document 0050 xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); 0051 % extract parent node 0052 parent = xml.getDocumentElement; 0053 % write obj into xml 0054 ltpda_xmlwrite(as(ii), xml, parent, ''); % Save the XML document. 0055 % ao_xml = xmlwrite(xml); % then to string 0056 % 0057 % x = xml(as(ii)); 0058 h = [h cellstr(ltpda_hash(xmlwrite(xml), 'MD5'))]; 0059 end 0060 0061 h = reshape(h, size(as)); 0062 0063 if numel(h) == 1 0064 h = cell2mat(h); 0065 end 0066