The MD4 message digest algorithm is based on the specification by R. Rivest and S. Dusse (OSF Distributed Management Environment Architecture, Open Software Foundation, May 1992). It is conjectured that it is computationally infeasible to produce two messages that result in the same MD4 digest.
GetDigestType returns a TText object that contains TMD4::kDigestType or TMD5::kDigestType, which uniquely identifies the message digest algorithm the object represents.
Write updates the message digest to include the digest of the specified message. This function is useful for digesting very large messages where it would be impractical to present the whole message in one contiguous in-memory array. For example, each line in a file could be passed to Write individually without having to load the file into an in-memory array.
Flush signals the end of the message and will cause the message digest algorithm to post the message digest to the TMessageDigest base class. Flush is only required if the default constructor was used in conjunction with the Write member function. The TMD#(message) constructors will perform the Flush operation automatically during construction.
The MD5 message digest algorithm ((C) RSA Data Security, Inc.) is believed to be more secure than MD4. The MD5 algorithm is more computationally intensive than the MD4 algorithm and is therefore less efficient. class TMD4 : public TMessageDigest {
// Copyright (C) 1995 Taligent, Inc. All rights reserved.
public:
//.................................................................
// Public constants.
static const TStandardText kDigestType;
//.................................................................
// Constructors and destructor
TMD4 ();
TMD4 (TPrimitiveTypeArray<unsigned char>& message);
TMD4 (const TMD4&);
virtual ~TMD4 ();
//.................................................................
// operator overloads.
TMD4& operator= (const TMD4&);
//.................................................................
// MCollectible overrides.
TStream& operator>>=(TStream& toWhere) const;
TStream& operator<<= (TStream& fromWhere);
//.................................................................
// TMD4 specific operations.
virtual void GetDigestType(TText& target) const;
virtual void Write (TPrimitiveTypeArray<unsigned char>& message);
virtual void Flush ();
};
class TMD5 : public TMessageDigest {
// Copyright (C) 1995 Taligent, Inc. All rights reserved.
public:
//.................................................................
// Public constants.
static const TStandardText kDigestType;
//.................................................................
// Constructors and destructor
TMD5 ();
TMD5 (TPrimitiveTypeArray<unsigned char>& message);
TMD5 (const TMD5&);
virtual ~TMD5 ();
//.................................................................
// operator overloads.
TMD5& operator= (const TMD5&);
//.................................................................
// MCollectible overrides.
TStream& operator>>=(TStream& toWhere) const;
TStream& operator<<= (TStream& fromWhere);
//.................................................................
// TMD5 specific operations.
virtual void GetDigestType(TText& target) const;
virtual void Write (TPrimitiveTypeArray<unsigned char>& message);
virtual void Flush ();
};
Instantiation
Allocate on the heap or stack. Safe to allocate at static constructor time. Member functions
TMD4(message) and TMD5(message) each define a constructor that accepts a message to be digested. This constructor is supplied for greater convenience and security. Once the object is constructed, the message has already been digested and the GetMessageDigest member function can be used to extract it. Note that if the default constructor is used, additional calls to Write and Flush must be made before the message digest will be completed. Deriving classes
Derived classes of TMD4 and TMD5 should follow the derived class requirements defined by TMessageDigest. Concurrency
TMD4 and TMD5 are not designed for concurrent access. Resource Use
No special requirements.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Generated with WebMaker