diff options
Diffstat (limited to '')
-rw-r--r-- | src/security/digest/messageDigest.cpp (renamed from vmime/utility/md5.hpp) | 51 |
1 files changed, 18 insertions, 33 deletions
diff --git a/vmime/utility/md5.hpp b/src/security/digest/messageDigest.cpp index eaded4c9..8fb56543 100644 --- a/vmime/utility/md5.hpp +++ b/src/security/digest/messageDigest.cpp @@ -17,52 +17,37 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // -#ifndef VMIME_UTILITY_MD5_HPP_INCLUDED -#define VMIME_UTILITY_MD5_HPP_INCLUDED +#include "vmime/security/digest/messageDigest.hpp" - -#include "vmime/base.hpp" -#include "vmime/config.hpp" +#include <sstream> namespace vmime { -namespace utility { +namespace security { +namespace digest { -class md5 +const string messageDigest::getHexDigest() const { -public: - - md5(); - md5(const vmime_uint8* const in, const unsigned long length); - md5(const string& in); - -public: + const byte* hash = getDigest(); + const int len = getDigestLength(); - const string hex(); - const vmime_uint8* hash(); + static const unsigned char hex[] = "0123456789abcdef"; - void update(const vmime_uint8* data, unsigned long len); - void update(const string& in); + std::ostringstream oss; -protected: + for (int i = 0 ; i < len ; ++i) + { + oss << hex[(hash[i] & 0xf0) >> 4]; + oss << hex[(hash[i] & 0x0f)]; + } - void init(); - void transformHelper(); - void transform(); - void finalize(); + return oss.str(); - vmime_uint32 m_hash[4]; +} - unsigned long m_byteCount; - vmime_uint8 m_block[64]; - bool m_finalized; -}; - - -} // utility +} // digest +} // security } // vmime - -#endif // VMIME_UTILITY_MD5_HPP_INCLUDED |