66 Error(
"TMD5::TMD5",
"digest is 0");
110 Error(
"TMD5::Update",
"Final() has already been called");
118 if ((
fBits[0] = t + (
len << 3)) < t)
141 memcpy(
fIn, buf, 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
184 count = (
fBits[0] >> 3) & 0x3f;
185 padLen = (count < 56) ? (56 - count) : (120 - count);
208 Error(
"TMD5::Print",
"Final() has not yet been called");
222 Error(
"TMD5::AsString",
"Final() has not yet been called");
227 static const char hexdig[] =
"0123456789abcdef";
228 for (
int i = 0; i < 16; ++i) {
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);
258 for (i = 0, j = 0; j <
len; i++, j += 4)
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))
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 )
365 memset(
x, 0,
sizeof(
x));
376 Error(
"TMD5::operator==(const TMD5&, const TMD5&)",
"arg1.Final() not yet called");
378 Error(
"TMD5::operator==(const TMD5&, const TMD5&)",
"arg2.Final() not yet called");
382 for (
int i = 0; i < 16; i++)
396 if (!md5ascii || strlen(md5ascii) < 32) {
401 char *buf = (
char *) md5ascii;
402 for (
int i = 0; i < 16; i++) {
406 sscanf(buf+2*i,
"%hx", &
d);
423 FILE *fid = fopen(file,
"r");
431 if (!fgets(buf, 33, fid)) {
432 SysError(
"TMD5::ReadChecksum",
"error reading checksum from %s", file);
453 FILE *fid = fopen(file,
"w");
477 if (
gSystem->GetPathInfo(file, &
id, &
size, &flags, &modtime) == 0) {
479 Error(
"TMD5::FileChecksum",
"%s not a regular file (%ld)", file, flags);
488 Int_t fd = open(file, O_RDONLY);
493 Error(
"TMD5::FileChecksum",
"cannot open %s in read mode", file);
500 const Int_t bufSize = 8192;
510 if (siz < 0 || siz != left) {
511 Error(
"TMD5::FileChecksum",
"error reading from file %s", file);
526 gSystem->Utime(file, modtime, modtime);
541 memcpy(digest, md5->
fDigest, 16);
545 memset(digest, 0, 16);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Streamer(TBuffer &) override
bool Bool_t
Boolean (0=false, 1=true) (bool).
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long long Long64_t
Portable signed long integer 8 bytes.
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void SysError(const char *location, const char *msgfmt,...)
Use this function in case a system (OS or GUI) related error occurred.
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)
TBuffer & operator<<(TBuffer &buf, const TMD5 &uuid)
Input operator. Delegate to Streamer.
Bool_t operator==(const TMD5 &m1, const TMD5 &m2)
Compare two message digests for equality.
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
UInt_t fBuf[4]
!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...
Char_t fString[33]
!string representation of digest
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.