ROOT  6.06/09
Reference Guide
TMD5.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 29/9/2001
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TMD5
13 
14 This code implements the MD5 message-digest algorithm.
15 The algorithm is due to Ron Rivest. This code was
16 written by Colin Plumb in 1993, no copyright is claimed.
17 This code is in the public domain; do with it what you wish.
18 
19 Equivalent code is available from RSA Data Security, Inc.
20 This code has been tested against that, and is equivalent,
21 except that you don't need to include two pages of legalese
22 with every copy.
23 
24 To compute the message digest of a chunk of bytes, create an
25 TMD5 object, call Update() as needed on buffers full of bytes, and
26 then call Final(), which will, optionally, fill a supplied 16-byte
27 array with the digest.
28 */
29 
30 #include "TMD5.h"
31 #include "TError.h"
32 #include "TSystem.h"
33 #include "Bytes.h"
34 #include <string.h>
35 #include <errno.h>
36 #ifdef R__WIN32
37 #include <io.h>
38 #endif
39 
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Create TMD5 object. Set bit count to 0 and buffer to mysterious
44 /// initialization constants.
45 
46 TMD5::TMD5():
47 fBits(), fIn(), fString(), fDigest(), fFinalized(kFALSE)
48 {
49  fBuf[0] = 0x67452301;
50  fBuf[1] = 0xefcdab89;
51  fBuf[2] = 0x98badcfe;
52  fBuf[3] = 0x10325476;
53 }
54 
55 ////////////////////////////////////////////////////////////////////////////////
56 /// Create finalized TMD5 object containing passed in 16 byte digest.
57 
58 TMD5::TMD5(const UChar_t *digest):
59 fBuf(), fBits(), fIn(), fString(), fFinalized(kTRUE)
60 {
61  if (digest)
62  memcpy(fDigest, digest, 16);
63  else {
64  memset(fDigest, 0, 16);
65  Error("TMD5::TMD5", "digest is 0");
66  }
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// MD5 copy ctor. Special copy ctor avoids copying unnecessary
71 /// temp arrays when finalized.
72 
73 TMD5::TMD5(const TMD5 &md5):
74 fString()
75 {
76  memcpy(fBuf, md5.fBuf, 4*sizeof(UInt_t));
77  memcpy(fBits, md5.fBits, 2*sizeof(UInt_t));
78  memcpy(fIn, md5.fIn, 64);
79 
80  memcpy(fDigest, md5.fDigest, 16);
81  fFinalized = md5.fFinalized;
82 }
83 
84 ////////////////////////////////////////////////////////////////////////////////
85 /// MD5 assignment operator. Special assignment operator avoids
86 /// copying unnecessary temp arrays when finalized.
87 
89 {
90  if (this != &rhs) {
91  memcpy(fBuf, rhs.fBuf, 4*sizeof(UInt_t));
92  memcpy(fBits, rhs.fBits, 2*sizeof(UInt_t));
93  memcpy(fIn, rhs.fIn, 64);
94 
95  memcpy(fDigest, rhs.fDigest, 16);
96  fFinalized = rhs.fFinalized;
97  memcpy(fString, rhs.fString, sizeof(fString));
98  }
99  return *this;
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Update TMD5 object to reflect the concatenation of another buffer full
104 /// of bytes.
105 
106 void TMD5::Update(const UChar_t *buf, UInt_t len)
107 {
108  if (fFinalized) {
109  Error("TMD5::Update", "Final() has already been called");
110  return;
111  }
112 
113  UInt_t t;
114 
115  // Update bitcount
116  t = fBits[0];
117  if ((fBits[0] = t + (len << 3)) < t)
118  fBits[1]++; // Carry from low to high
119  fBits[1] += len >> 29;
120 
121  t = (t >> 3) & 0x3f;
122 
123  // Handle any leading odd-sized chunks
124  if (t) {
125  UChar_t *p = (UChar_t *) fIn + t;
126 
127  t = 64 - t;
128  if (len < t) {
129  memcpy(p, buf, len);
130  return;
131  }
132  memcpy(p, buf, t);
133  Transform(fBuf, fIn);
134  buf += t;
135  len -= t;
136  }
137 
138  // Process data in 64-byte chunks
139  while (len >= 64) {
140  memcpy(fIn, buf, 64);
141  Transform(fBuf, fIn);
142  buf += 64;
143  len -= 64;
144  }
145 
146  // Handle any remaining bytes of data
147  memcpy(fIn, buf, len);
148 }
149 
150 ////////////////////////////////////////////////////////////////////////////////
151 /// MD5 finalization, ends an MD5 message-digest operation, writing the
152 /// the message digest and zeroizing the context.
153 /// Returns digest.
154 
155 void TMD5::Final(UChar_t digest[16])
156 {
157  Final();
158  memcpy(digest, fDigest, 16);
159 }
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// MD5 finalization, ends an MD5 message-digest operation, writing the
163 /// the message digest and zeroizing the context.
164 
166 {
167  if (fFinalized)
168  return;
169 
170  UInt_t count, padLen;
171  UChar_t bits[8];
172 
173  static UChar_t padding[64] = {
174  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
175  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
176  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
177  };
178 
179  // Save number of bits
180  Encode(bits, fBits, 8);
181 
182  // Pad out to 56 mod 64
183  count = (fBits[0] >> 3) & 0x3f;
184  padLen = (count < 56) ? (56 - count) : (120 - count);
185  Update(padding, padLen);
186 
187  // Append length (before padding)
188  Update(bits, 8);
189 
190  // Store state in digest
191  Encode(fDigest, fBuf, 16);
192 
193  // Zero out sensitive information
194  memset(fBuf, 0, 4*sizeof(UInt_t));
195  memset(fBits, 0, 2*sizeof(UInt_t));
196  memset(fIn, 0, 64);
197 
198  fFinalized = kTRUE;
199 }
200 
201 ////////////////////////////////////////////////////////////////////////////////
202 /// Print digest in ascii hex form.
203 
204 void TMD5::Print() const
205 {
206  if (!fFinalized) {
207  Error("TMD5::Print", "Final() has not yet been called");
208  return;
209  }
210 
211  printf("%s\n", AsString());
212 }
213 
214 ////////////////////////////////////////////////////////////////////////////////
215 /// Return message digest as string. Returns "" in case Final() has
216 /// not yet been called.
217 
218 const char *TMD5::AsString() const
219 {
220  if (!fFinalized) {
221  Error("TMD5::AsString", "Final() has not yet been called");
222  return "";
223  }
224 
225  if (!fString[0]) {
226  static const char hexdig[] = "0123456789abcdef";
227  for (int i = 0; i < 16; ++i) {
228  fString[i * 2] = hexdig[fDigest[i] / 16];
229  fString[i * 2 + 1] = hexdig[fDigest[i] % 16];
230  }
231  }
232  return fString;
233 }
234 
235 ////////////////////////////////////////////////////////////////////////////////
236 /// Encodes input into output. Assumes len is a multiple of 4.
237 
238 void TMD5::Encode(UChar_t *out, const UInt_t *in, UInt_t len)
239 {
240  UInt_t i, j;
241 
242  for (i = 0, j = 0; j < len; i++, j += 4) {
243  out[j] = (UChar_t)(in[i] & 0xff);
244  out[j+1] = (UChar_t)((in[i] >> 8) & 0xff);
245  out[j+2] = (UChar_t)((in[i] >> 16) & 0xff);
246  out[j+3] = (UChar_t)((in[i] >> 24) & 0xff);
247  }
248 }
249 
250 ////////////////////////////////////////////////////////////////////////////////
251 /// Decodes input into output. Assumes len is a multiple of 4.
252 
253 void TMD5::Decode(UInt_t *out, const UChar_t *in, UInt_t len)
254 {
255  UInt_t i, j;
256 
257  for (i = 0, j = 0; j < len; i++, j += 4)
258  out[i] = ((UInt_t)in[j]) | (((UInt_t)in[j+1]) << 8) |
259  (((UInt_t)in[j+2]) << 16) | (((UInt_t)in[j+3]) << 24);
260 }
261 
262 
263 // The four core functions - F1 is optimized somewhat
264 //#define F1(x, y, z) (x & y | ~x & z)
265 #define F1(x, y, z) (z ^ (x & (y ^ z)))
266 #define F2(x, y, z) F1(z, x, y)
267 #define F3(x, y, z) (x ^ y ^ z)
268 #define F4(x, y, z) (y ^ (x | ~z))
269 
270 // This is the central step in the MD5 algorithm
271 #define MD5STEP(f, w, x, y, z, data, s) \
272  ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
273 
274 ////////////////////////////////////////////////////////////////////////////////
275 /// The core of the MD5 algorithm, this alters an existing MD5 hash to
276 /// reflect the addition of 16 longwords of new data. Update() blocks
277 /// the data and converts bytes into longwords for this routine.
278 
279 void TMD5::Transform(UInt_t buf[4], const UChar_t in[64])
280 {
281  UInt_t a, b, c, d, x[16];
282 
283  a = buf[0];
284  b = buf[1];
285  c = buf[2];
286  d = buf[3];
287 
288  Decode(x, in, 64);
289 
290  MD5STEP(F1, a, b, c, d, x[0] + 0xd76aa478, 7);
291  MD5STEP(F1, d, a, b, c, x[1] + 0xe8c7b756, 12);
292  MD5STEP(F1, c, d, a, b, x[2] + 0x242070db, 17);
293  MD5STEP(F1, b, c, d, a, x[3] + 0xc1bdceee, 22);
294  MD5STEP(F1, a, b, c, d, x[4] + 0xf57c0faf, 7);
295  MD5STEP(F1, d, a, b, c, x[5] + 0x4787c62a, 12);
296  MD5STEP(F1, c, d, a, b, x[6] + 0xa8304613, 17);
297  MD5STEP(F1, b, c, d, a, x[7] + 0xfd469501, 22);
298  MD5STEP(F1, a, b, c, d, x[8] + 0x698098d8, 7);
299  MD5STEP(F1, d, a, b, c, x[9] + 0x8b44f7af, 12);
300  MD5STEP(F1, c, d, a, b, x[10] + 0xffff5bb1, 17);
301  MD5STEP(F1, b, c, d, a, x[11] + 0x895cd7be, 22);
302  MD5STEP(F1, a, b, c, d, x[12] + 0x6b901122, 7);
303  MD5STEP(F1, d, a, b, c, x[13] + 0xfd987193, 12);
304  MD5STEP(F1, c, d, a, b, x[14] + 0xa679438e, 17);
305  MD5STEP(F1, b, c, d, a, x[15] + 0x49b40821, 22);
306 
307  MD5STEP(F2, a, b, c, d, x[1] + 0xf61e2562, 5);
308  MD5STEP(F2, d, a, b, c, x[6] + 0xc040b340, 9);
309  MD5STEP(F2, c, d, a, b, x[11] + 0x265e5a51, 14);
310  MD5STEP(F2, b, c, d, a, x[0] + 0xe9b6c7aa, 20);
311  MD5STEP(F2, a, b, c, d, x[5] + 0xd62f105d, 5);
312  MD5STEP(F2, d, a, b, c, x[10] + 0x02441453, 9);
313  MD5STEP(F2, c, d, a, b, x[15] + 0xd8a1e681, 14);
314  MD5STEP(F2, b, c, d, a, x[4] + 0xe7d3fbc8, 20);
315  MD5STEP(F2, a, b, c, d, x[9] + 0x21e1cde6, 5);
316  MD5STEP(F2, d, a, b, c, x[14] + 0xc33707d6, 9);
317  MD5STEP(F2, c, d, a, b, x[3] + 0xf4d50d87, 14);
318  MD5STEP(F2, b, c, d, a, x[8] + 0x455a14ed, 20);
319  MD5STEP(F2, a, b, c, d, x[13] + 0xa9e3e905, 5);
320  MD5STEP(F2, d, a, b, c, x[2] + 0xfcefa3f8, 9);
321  MD5STEP(F2, c, d, a, b, x[7] + 0x676f02d9, 14);
322  MD5STEP(F2, b, c, d, a, x[12] + 0x8d2a4c8a, 20);
323 
324  MD5STEP(F3, a, b, c, d, x[5] + 0xfffa3942, 4);
325  MD5STEP(F3, d, a, b, c, x[8] + 0x8771f681, 11);
326  MD5STEP(F3, c, d, a, b, x[11] + 0x6d9d6122, 16);
327  MD5STEP(F3, b, c, d, a, x[14] + 0xfde5380c, 23);
328  MD5STEP(F3, a, b, c, d, x[1] + 0xa4beea44, 4);
329  MD5STEP(F3, d, a, b, c, x[4] + 0x4bdecfa9, 11);
330  MD5STEP(F3, c, d, a, b, x[7] + 0xf6bb4b60, 16);
331  MD5STEP(F3, b, c, d, a, x[10] + 0xbebfbc70, 23);
332  MD5STEP(F3, a, b, c, d, x[13] + 0x289b7ec6, 4);
333  MD5STEP(F3, d, a, b, c, x[0] + 0xeaa127fa, 11);
334  MD5STEP(F3, c, d, a, b, x[3] + 0xd4ef3085, 16);
335  MD5STEP(F3, b, c, d, a, x[6] + 0x04881d05, 23);
336  MD5STEP(F3, a, b, c, d, x[9] + 0xd9d4d039, 4);
337  MD5STEP(F3, d, a, b, c, x[12] + 0xe6db99e5, 11);
338  MD5STEP(F3, c, d, a, b, x[15] + 0x1fa27cf8, 16);
339  MD5STEP(F3, b, c, d, a, x[2] + 0xc4ac5665, 23);
340 
341  MD5STEP(F4, a, b, c, d, x[0] + 0xf4292244, 6);
342  MD5STEP(F4, d, a, b, c, x[7] + 0x432aff97, 10);
343  MD5STEP(F4, c, d, a, b, x[14] + 0xab9423a7, 15);
344  MD5STEP(F4, b, c, d, a, x[5] + 0xfc93a039, 21);
345  MD5STEP(F4, a, b, c, d, x[12] + 0x655b59c3, 6);
346  MD5STEP(F4, d, a, b, c, x[3] + 0x8f0ccc92, 10);
347  MD5STEP(F4, c, d, a, b, x[10] + 0xffeff47d, 15);
348  MD5STEP(F4, b, c, d, a, x[1] + 0x85845dd1, 21);
349  MD5STEP(F4, a, b, c, d, x[8] + 0x6fa87e4f, 6);
350  MD5STEP(F4, d, a, b, c, x[15] + 0xfe2ce6e0, 10);
351  MD5STEP(F4, c, d, a, b, x[6] + 0xa3014314, 15);
352  MD5STEP(F4, b, c, d, a, x[13] + 0x4e0811a1, 21);
353  MD5STEP(F4, a, b, c, d, x[4] + 0xf7537e82, 6);
354  MD5STEP(F4, d, a, b, c, x[11] + 0xbd3af235, 10);
355  MD5STEP(F4, c, d, a, b, x[2] + 0x2ad7d2bb, 15);
356  MD5STEP(F4, b, c, d, a, x[9] + 0xeb86d391, 21);
357 
358  buf[0] += a;
359  buf[1] += b;
360  buf[2] += c;
361  buf[3] += d;
362 
363  // Zero out sensitive information
364  memset(x, 0, sizeof(x));
365 }
366 
367 ////////////////////////////////////////////////////////////////////////////////
368 /// Compare two message digests for equality.
369 
370 Bool_t operator==(const TMD5 &m1, const TMD5 &m2)
371 {
372  // Make sure both are finalized.
373  if (!m1.fFinalized || !m2.fFinalized) {
374  if (!m1.fFinalized)
375  Error("TMD5::operator==(const TMD5&, const TMD5&)", "arg1.Final() not yet called");
376  if (!m2.fFinalized)
377  Error("TMD5::operator==(const TMD5&, const TMD5&)", "arg2.Final() not yet called");
378  return kFALSE;
379  }
380 
381  for (int i = 0; i < 16; i++)
382  if (m1.fDigest[i] != m2.fDigest[i])
383  return kFALSE;
384 
385  return kTRUE;
386 }
387 
388 ////////////////////////////////////////////////////////////////////////////////
389 /// Set the digest from the ASCII representation 'md5ascii'. The caller
390 /// is responsible to make sure that the 32 chars md5ascii are valid.
391 /// Returns -1 if md5ascii is malformed, returns 0 otherwise.
392 
393 Int_t TMD5::SetDigest(const char *md5ascii)
394 {
395  if (!md5ascii || strlen(md5ascii) < 32) {
396  // Invalid input or ASCII representation
397  return -1;
398  }
399 
400  char *buf = (char *) md5ascii;
401  for (int i = 0; i < 16; i++) {
402  UShort_t d;
403  char s = buf[2+2*i];
404  buf[2+2*i] = 0;
405  sscanf(buf+2*i, "%hx", &d);
406  buf[2+2*i] = s;
407  fDigest[i] = (UChar_t) d;
408  }
409  fFinalized = kTRUE;
410 
411  return 0;
412 }
413 
414 ////////////////////////////////////////////////////////////////////////////////
415 /// Returns checksum stored in ASCII in specified file. Use to read files
416 /// created via WriteChecksum(). The returned TMD5 object must be deleted
417 /// by the user. Returns 0 in case the file cannot be opened or in case of
418 /// error. Static utility function.
419 
420 TMD5 *TMD5::ReadChecksum(const char *file)
421 {
422  FILE *fid = fopen(file, "r");
423  if (!fid) {
424  // file cannot be opened
425  return 0;
426  }
427 
428  char buf[33];
429 
430  if (!fgets(buf, 33, fid)) {
431  SysError("TMD5::ReadChecksum", "error reading checksum from %s", file);
432  fclose(fid);
433  return 0;
434  }
435 
436  fclose(fid);
437 
438  TMD5 *md5 = new TMD5;
439  md5->SetDigest(buf);
440 
441  return md5;
442 }
443 
444 ////////////////////////////////////////////////////////////////////////////////
445 /// Writes checksum in ASCII format to specified file. This file can
446 /// directly be read by ReadChecksum(). The md5 must have been finalized.
447 /// Returns -1 in case file cannot be opened or in case of error,
448 /// 0 otherwise. Static utility function.
449 
450 Int_t TMD5::WriteChecksum(const char *file, const TMD5 *md5)
451 {
452  FILE *fid = fopen(file, "w");
453  if (!fid) {
454  // file cannot be opened
455  return -1;
456  }
457 
458  fputs(md5->AsString(), fid);
459 
460  fclose(fid);
461 
462  return 0;
463 }
464 
465 ////////////////////////////////////////////////////////////////////////////////
466 /// Returns checksum of specified file. The returned TMD5 object must
467 /// be deleted by the user. Returns 0 in case the file does not exists
468 /// or in case of error. This function preserves the modtime of the file
469 /// so it can be safely used in conjunction with methods that keep track
470 /// of the file's modtime. Static utility function.
471 
472 TMD5 *TMD5::FileChecksum(const char *file)
473 {
474  Long64_t size;
475  Long_t id, flags, modtime;
476  if (gSystem->GetPathInfo(file, &id, &size, &flags, &modtime) == 0) {
477  if (flags > 1) {
478  Error("TMD5::FileChecksum", "%s not a regular file (%ld)", file, flags);
479  return 0;
480  }
481  } else {
482  // file does not exist
483  return 0;
484  }
485 
486 #ifndef WIN32
487  Int_t fd = open(file, O_RDONLY);
488 #else
489  Int_t fd = open(file, O_RDONLY | O_BINARY);
490 #endif
491  if (fd < 0) {
492  Error("TMD5::FileChecksum", "cannot open %s in read mode", file);
493  return 0;
494  }
495 
496  TMD5 *md5 = new TMD5;
497 
498  Long64_t pos = 0;
499  const Int_t bufSize = 8192;
500  UChar_t buf[bufSize];
501 
502  while (pos < size) {
503  Long64_t left = Long64_t(size - pos);
504  if (left > bufSize)
505  left = bufSize;
506  Int_t siz;
507  while ((siz = read(fd, buf, left)) < 0 && TSystem::GetErrno() == EINTR)
509  if (siz < 0 || siz != left) {
510  Error("TMD5::FileChecksum", "error reading from file %s", file);
511  close(fd);
512  delete md5;
513  return 0;
514  }
515 
516  md5->Update(buf, left);
517 
518  pos += left;
519  }
520 
521  close(fd);
522 
523  md5->Final();
524 
525  gSystem->Utime(file, modtime, modtime);
526 
527  return md5;
528 }
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// Returns checksum of specified file in digest argument. Returns -1 in
532 /// case of error, 0 otherwise. This method preserves the modtime of the
533 /// file so it can be safely used in conjunction with methods that keep
534 /// track of the file's modtime. Static utility function.
535 
536 Int_t TMD5::FileChecksum(const char *file, UChar_t digest[16])
537 {
538  TMD5 *md5 = FileChecksum(file);
539  if (md5) {
540  memcpy(digest, md5->fDigest, 16);
541  delete md5;
542  return 0;
543  } else
544  memset(digest, 0, 16);
545 
546  return -1;
547 }
548 
549 ////////////////////////////////////////////////////////////////////////////////
550 /// Input operator. Delegate to Streamer.
551 
552 TBuffer &operator<<(TBuffer &buf, const TMD5 &uuid)
553 {
554  R__ASSERT( buf.IsWriting() );
555 
556  const_cast<TMD5&>(uuid).Streamer(buf);
557  return buf;
558 }
void Print() const
Print digest in ascii hex form.
Definition: TMD5.cxx:204
double read(const std::string &file_name)
reading
long long Long64_t
Definition: RtypesCore.h:69
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
Definition: TMD5.cxx:472
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Definition: TMD5.cxx:165
#define F4(x, y, z)
Definition: TMD5.cxx:268
void Encode(UChar_t *out, const UInt_t *in, UInt_t len)
Encodes input into output. Assumes len is a multiple of 4.
Definition: TMD5.cxx:238
#define F3(x, y, z)
Definition: TMD5.cxx:267
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1363
unsigned short UShort_t
Definition: RtypesCore.h:36
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
TMD5 & operator=(const TMD5 &rhs)
MD5 assignment operator.
Definition: TMD5.cxx:88
#define R__ASSERT(e)
Definition: TError.h:98
#define O_BINARY
Definition: civetweb.c:273
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
Bool_t fFinalized
Definition: TMD5.h:56
void SysError(const char *location, const char *msgfmt,...)
static Int_t GetErrno()
Static function returning system error number.
Definition: TSystem.cxx:264
Double_t x[n]
Definition: legend1.C:17
void Decode(UInt_t *out, const UChar_t *in, UInt_t len)
Decodes input into output. Assumes len is a multiple of 4.
Definition: TMD5.cxx:253
const char * AsString() const
Return message digest as string.
Definition: TMD5.cxx:218
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:46
UInt_t fBuf[4]
Definition: TMD5.h:51
XFontStruct * id
Definition: TGX11.cxx:108
#define F1(x, y, z)
Definition: TMD5.cxx:265
void Error(const char *location, const char *msgfmt,...)
char * out
Definition: TBase64.cxx:29
Bool_t IsWriting() const
Definition: TBuffer.h:82
Char_t fString[33]
temp buffer
Definition: TMD5.h:54
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
Definition: TMD5.cxx:106
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
static Int_t WriteChecksum(const char *file, const TMD5 *md5)
Writes checksum in ASCII format to specified file.
Definition: TMD5.cxx:450
UChar_t fIn[64]
temp buffer
Definition: TMD5.h:53
unsigned int UInt_t
Definition: RtypesCore.h:42
#define F2(x, y, z)
Definition: TMD5.cxx:266
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.
Definition: TSystem.cxx:1490
long Long_t
Definition: RtypesCore.h:50
#define MD5STEP(f, w, x, y, z, data, s)
Definition: TMD5.cxx:271
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Int_t SetDigest(const char *md5ascii)
Set the digest from the ASCII representation 'md5ascii'.
Definition: TMD5.cxx:393
Bool_t operator==(const TMD5 &m1, const TMD5 &m2)
Compare two message digests for equality.
Definition: TMD5.cxx:370
static void ResetErrno()
Static function resetting system error number.
Definition: TSystem.cxx:280
unsigned char UChar_t
Definition: RtypesCore.h:34
static TMD5 * ReadChecksum(const char *file)
Returns checksum stored in ASCII in specified file.
Definition: TMD5.cxx:420
const Bool_t kTRUE
Definition: Rtypes.h:91
UChar_t fDigest[16]
string representation of digest
Definition: TMD5.h:55
ClassImp(TMD5) TMD5
Create TMD5 object.
Definition: TMD5.cxx:40
UInt_t fBits[2]
temp buffer
Definition: TMD5.h:52
TBuffer & operator<<(TBuffer &buf, const TMD5 &uuid)
Input operator. Delegate to Streamer.
Definition: TMD5.cxx:552
void Transform(UInt_t buf[4], const UChar_t in[64])
The core of the MD5 algorithm, this alters an existing MD5 hash to reflect the addition of 16 longwor...
Definition: TMD5.cxx:279