// documentation and/or software.
//
-#include "md5.hpp"
+#include "addon/md5.hpp"
#include <assert.h>
-#include <strings.h>
-#include <iostream>
#include <stdexcept>
-MD5::MD5() {
+MD5::MD5() :
+ finalized()
+{
init();
}
count[1] += ((uint32_t)input_length >> 29);
-
buffer_space = 64 - buffer_index; // how much space is left in buffer
// Transform as many times as possible.
} else
input_index=0; // so we can buffer the whole input
-
// and here we do the buffering:
memcpy(buffer+buffer_index, input+input_index, input_length-input_index);
}
}
}
-
-MD5::MD5(FILE *file) {
+MD5::MD5(FILE *file) :
+ finalized()
+{
init(); // must be called be all constructors
update(file);
finalize ();
}
-MD5::MD5(std::istream& stream) {
+MD5::MD5(std::istream& stream) :
+ finalized()
+{
init(); // must called by all constructors
update (stream);
finalize();
}
-MD5::MD5(std::ifstream& stream) {
+MD5::MD5(std::ifstream& stream) :
+ finalized()
+{
init(); // must called by all constructors
update (stream);
finalize();
return stream;
}
-
// PRIVATE METHODS:
void MD5::init() {
a += I(b, c, d) + x + ac;
a = rotate_left (a, s) +b;
}
+
+/* EOF */