[ROOT] Problem with TMD5

From: Damon Spayde (spayde@jlab.org)
Date: Thu Jul 08 2004 - 19:46:01 MEST


I would like to use the TMD5 ROOT class to calculate MD5 checksums of 
certain files.  However, I have found that MD5 checksums calculated with 
TMD5 are not the same as those calculated with other methods, e.g. 
'md5sum' on Linux machines.  Below is the output of a ROOT script 
(attached as file md5test.cxx) that calculates the MD5 checksum of a 
zero-length string with TMD5 and the output from md5sum:

[spayde@uiuc-gzero blinding]$ root -b md5test.cxx
   *******************************************
   *                                         *
   *        W E L C O M E  to  R O O T       *
   *                                         *
   *   Version   4.00/04       5 June 2004   *
   *                                         *
   *  You are welcome to visit our Web site  *
   *          http://root.cern.ch            *
   *                                         *
   *******************************************

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.133, Apr 18 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
Processing md5test.cxx...
MD5 Check Sum of Zero Length String:
227b7f48d21283f63bc9bbc15b44ea1a
root [1] .!echo -n "" | md5sum
d41d8cd98f00b204e9800998ecf8427e  -
root [2]

I get similar results (the MD5 sums do not agree between the two 
methods) when using finite length strings or files.  I am running ROOT 
version 4.00/04 on a RedHat Enterprise Linux 3 system.  Any help would 
be greatly appreciated.

					Regards,
					Damon

-- 
-------------------------------------------------------------------------
Damon Spayde
University of Illinois at Urbana-Champaign

Jefferson Lab                              E-mail:  spayde@jlab.org
Counting House Cubicle 16                  Phone:  (757) 269-5192
-------------------------------------------------------------------------



void md5test(void) {
  
  TMD5* md5 = new TMD5();

  md5->Update((UChar_t*) 0, 0);
  md5->Final();
  cout << "MD5 Check Sum of Zero Length String:  ";
  cout << endl;
  md5->Print();

}



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET