diff options
author | Daniel Vassdal <shutter@canternet.org> | 2014-07-02 20:55:33 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-08-04 12:38:12 +0200 |
commit | 5c7db14a557d7f980dfaa8c10d40c1ccc554b35d (patch) | |
tree | d9d0b3161928f1ba9cbf0ced5f894c2d1c6a1886 /src/modules/m_md5.cpp | |
parent | 0c0a7b6404c5de51241cdaa3eb159d014ef51024 (diff) |
Hashing: Redo API
* Don't assume the printable output of hashes is hex
* Add virtual Compare() function, usable for KDFs like BCrypt
Some changes and bugfixes are by @attilamolnar, original PR #767
Diffstat (limited to 'src/modules/m_md5.cpp')
-rw-r--r-- | src/modules/m_md5.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index ecf76d07c..6e6f5006f 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -244,29 +244,15 @@ class MD5Provider : public HashProvider MD5Final((unsigned char*)dest, &context); } - - void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey, size_t srclen) - { - unsigned char bytes[16]; - - MyMD5((char*)bytes, (void*)src, srclen, ikey); - - for (int i = 0; i < 16; i++) - { - *dest++ = xtab[bytes[i] / 16]; - *dest++ = xtab[bytes[i] % 16]; - } - *dest++ = 0; - } public: - std::string sum(const std::string& data) + std::string GenerateRaw(const std::string& data) { char res[16]; MyMD5(res, (void*)data.data(), data.length(), NULL); return std::string(res, 16); } - MD5Provider(Module* parent) : HashProvider(parent, "hash/md5", 16, 64) {} + MD5Provider(Module* parent) : HashProvider(parent, "md5", 16, 64) {} }; class ModuleMD5 : public Module |