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