]> git.tdb.fi Git - libs/crypto.git/blobdiff - source/md5.h
Use BlockHash as base class of MD5 as well
[libs/crypto.git] / source / md5.h
index f47723c5b49ff619f1d6237620bb955c6ff7eba5..32b468b02ccd33f3f3b35203edcae16d40149262 100644 (file)
@@ -2,18 +2,16 @@
 #define MSP_CRYPTO_MD5_H_
 
 #include <msp/core/inttypes.h>
-#include "hash.h"
+#include "blockhash.h"
 
 namespace Msp {
 namespace Crypto {
 
-class MD5: public Hash
+class MD5: public BlockHash<64>
 {
 private:
        UInt32 buffer[4];
        UInt64 processed_bytes;
-       char unprocessed[64];
-       unsigned unprocessed_bytes;
 
        static UInt32 sin_table[64];
        static unsigned rotate_table[16];
@@ -28,12 +26,10 @@ private:
 public:
        virtual unsigned get_digest_size() const { return 16; }
 
-       using Hash::update;
-       virtual void update(const char *, unsigned);
        virtual unsigned get_digest(char *, unsigned) const;
 
 private:
-       void process_block(const char *);
+       virtual void process_block(const char *);
 
        template<unsigned, unsigned, unsigned>
        static void perform_round(UInt32 *, const UInt32 *);