X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Faddon%2Fmd5.cpp;h=deb069445f8f0d603dacf16c89ecef5367a5b08b;hb=3aa6936791cf24344e27d452ab2fd8c33fb5a2e8;hp=30207216eb5c64afd97ab2412d6c3f83e8a7f074;hpb=c686b6e6bc389edb08cef2215b0882b2b0ff4b4b;p=supertux.git diff --git a/src/addon/md5.cpp b/src/addon/md5.cpp index 30207216e..deb069445 100644 --- a/src/addon/md5.cpp +++ b/src/addon/md5.cpp @@ -41,14 +41,14 @@ // documentation and/or software. // -#include "md5.hpp" +#include "addon/md5.hpp" #include -#include -#include #include -MD5::MD5() { +MD5::MD5() : + finalized() +{ init(); } @@ -67,7 +67,6 @@ void MD5::update (uint8_t* input, uint32_t input_length) { 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. @@ -85,7 +84,6 @@ void MD5::update (uint8_t* input, uint32_t input_length) { } 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); } @@ -121,20 +119,25 @@ void MD5::update(std::ifstream& stream) { } } - -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(); @@ -167,7 +170,6 @@ std::ostream& operator<<(std::ostream &stream, MD5 context) { return stream; } - // PRIVATE METHODS: void MD5::init() { @@ -396,3 +398,5 @@ inline void MD5::II(uint32_t& a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, a += I(b, c, d) + x + ac; a = rotate_left (a, s) +b; } + +/* EOF */