49fBits(), fIn(), fString(), fDigest(), fFinalized(
kFALSE)
61fBuf(), fBits(), fIn(), fString(), fFinalized(
kTRUE)
67 Error(
"TMD5::TMD5",
"digest is 0");
111 Error(
"TMD5::Update",
"Final() has already been called");
119 if ((
fBits[0] = t + (
len << 3)) < t)
142 memcpy(
fIn, buf, 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
185 count = (
fBits[0] >> 3) & 0x3f;
186 padLen = (count < 56) ? (56 - count) : (120 - count);
209 Error(
"TMD5::Print",
"Final() has not yet been called");
223 Error(
"TMD5::AsString",
"Final() has not yet been called");
228 static const char hexdig[] =
"0123456789abcdef";
229 for (
int i = 0; i < 16; ++i) {
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);
259 for (i = 0, j = 0; j <
len; i++, j += 4)
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))
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 )
366 memset(
x, 0,
sizeof(
x));
377 Error(
"TMD5::operator==(const TMD5&, const TMD5&)",
"arg1.Final() not yet called");
379 Error(
"TMD5::operator==(const TMD5&, const TMD5&)",
"arg2.Final() not yet called");
383 for (
int i = 0; i < 16; i++)
397 if (!md5ascii || strlen(md5ascii) < 32) {
402 char *buf = (
char *) md5ascii;
403 for (
int i = 0; i < 16; i++) {
407 sscanf(buf+2*i,
"%hx", &
d);
424 FILE *fid = fopen(
file,
"r");
432 if (!fgets(buf, 33, fid)) {
433 SysError(
"TMD5::ReadChecksum",
"error reading checksum from %s",
file);
454 FILE *fid = fopen(
file,
"w");
480 Error(
"TMD5::FileChecksum",
"%s not a regular file (%ld)",
file, flags);
494 Error(
"TMD5::FileChecksum",
"cannot open %s in read mode",
file);
501 const Int_t bufSize = 8192;
511 if (siz < 0 || siz != left) {
512 Error(
"TMD5::FileChecksum",
"error reading from file %s",
file);
542 memcpy(digest, md5->
fDigest, 16);
546 memset(digest, 0, 16);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void SysError(const char *location, const char *msgfmt,...)
Use this function in case a system (OS or GUI) related error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
#define MD5STEP(f, w, x, y, z, data, s)
Bool_t operator==(const TMD5 &m1, const TMD5 &m2)
Compare two message digests for equality.
void Streamer(TBuffer &) override
R__EXTERN TSystem * gSystem
Buffer base class used for serializing objects.
This code implements the MD5 message-digest algorithm.
const char * AsString() const
Return message digest as string.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
TMD5 & operator=(const TMD5 &rhs)
MD5 assignment operator.
void Decode(UInt_t *out, const UChar_t *in, UInt_t len)
Decodes input into output. Assumes len is a multiple of 4.
UChar_t fIn[64]
temp buffer
UInt_t fBits[2]
temp buffer
TMD5()
Create TMD5 object.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Int_t SetDigest(const char *md5ascii)
Set the digest from the ASCII representation 'md5ascii'.
static TMD5 * ReadChecksum(const char *file)
Returns checksum stored in ASCII in specified file.
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...
UChar_t fDigest[16]
string representation of digest
Char_t fString[33]
temp buffer
void Print() const
Print digest in ascii hex form.
void Encode(UChar_t *out, const UInt_t *in, UInt_t len)
Encodes input into output. Assumes len is a multiple of 4.
static Int_t WriteChecksum(const char *file, const TMD5 *md5)
Writes checksum in ASCII format to specified file.
static void ResetErrno()
Static function resetting system error number.
static Int_t GetErrno()
Static function returning system error number.
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.
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.