Mobile API Reference  MicroStrategy 2019
TMD5.h
Go to the documentation of this file.
1 // File: TMD5.h
2 // Date: 3/22/02
3 // Author: T.S. Berman
4 //
5 // Copyright (C) 2002 MicroStrategy Incorporated
6 // All rights reserved
7 //
8 
9 #ifndef MBase_TMD5_h
10 #define MBase_TMD5_h
11 
13 // //
14 // TMD5 //
15 // //
16 // This code implements the MD5 message-digest algorithm. //
17 // The algorithm is due to Ron Rivest. This code was //
18 // written by Colin Plumb in 1993, no copyright is claimed. //
19 // This code is in the public domain; do with it what you wish. //
20 // //
21 // Equivalent code is available from RSA Data Security, Inc. //
22 // This code has been tested against that, and is equivalent, //
23 // except that you don't need to include two pages of legalese //
24 // with every copy. //
25 // //
26 // To compute the message digest of a chunk of bytes, create an //
27 // TMD5 object, call Update() as needed on buffers full of bytes, and //
28 // then call Final(), which will, optionally, fill a supplied 16-byte //
29 // array with the digest. //
30 // //
32 
33 #include <stdio.h>
34 #include <string.h>
35 
36 #include "UUIDTypes.h"
37 #include "../../Defines/BasicTypes.h"
38 
39 namespace MBase
40 {
41  // forward declaration
42  class TMD5;
43  bool operator==(const TMD5 &m1, const TMD5 &m2);
44 
45 
46  class TMD5
47  {
48 
49  friend bool operator==(const TMD5 &m1, const TMD5 &m2);
50 
51  private:
52  unsigned Int32 fBuf[4];
53  unsigned Int32 fBits[2];
54  unsigned char fIn[64];
55  unsigned char fDigest[16]; //message digest
56  bool fFinalized; //true if message digest has been finalized
57 
58  void Transform(unsigned Int32 buf[4], const unsigned Int32 in[16]);
59  void ByteReverse(unsigned char *buf, unsigned Int32 longs);
60 
61  public:
62  TMD5();
63  TMD5(const unsigned char *digest);
64  TMD5(const TMD5 &md5);
65  TMD5 &operator=(const TMD5 &rhs);
66 
67  void Update(const unsigned char *buf, unsigned Int32 len);
68  void Final();
69  void Final(unsigned char digest[16]);
70  void Print() const;
71  const char *AsString() const;
72  };
73 }
74 
75 #endif // MBase_TMD5_h
const char * AsString() const
void Update(const unsigned char *buf, unsigned Int32 len)
bool operator==(const Allocator< _Ty > &left, const Allocator< _UT > &right)
Definition: Allocator.h:204
UINT len
Definition: Msi_bstr.h:37
#define m2
Definition: aesopt.h:598
void Print() const
#define Int32
Definition: BasicTypes.h:20
void Final()
Definition: Allocator.h:47
Definition: TMD5.h:46
friend bool operator==(const TMD5 &m1, const TMD5 &m2)
#define m1
Definition: aesopt.h:597
TMD5 & operator=(const TMD5 &rhs)