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