diff options
author | smatz <smatz@openttd.org> | 2009-10-26 23:03:03 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-10-26 23:03:03 +0000 |
commit | 1bc7684ff0224e16f50f71879ce017988270650e (patch) | |
tree | b96cddff38d6b998b13d123eaa3e1b664bddb240 | |
parent | e61008b599e1c45394406654dada60ba8ace0705 (diff) | |
download | openttd-1bc7684ff0224e16f50f71879ce017988270650e.tar.xz |
(svn r17883) -Codechange: little cleaning in md5.cpp and md5.h
-rw-r--r-- | src/3rdparty/md5/md5.cpp | 9 | ||||
-rw-r--r-- | src/3rdparty/md5/md5.h | 10 |
2 files changed, 5 insertions, 14 deletions
diff --git a/src/3rdparty/md5/md5.cpp b/src/3rdparty/md5/md5.cpp index 8854f06b3..d2d6fbab7 100644 --- a/src/3rdparty/md5/md5.cpp +++ b/src/3rdparty/md5/md5.cpp @@ -175,7 +175,7 @@ void Md5::Process(const uint8 *data /*[64]*/) uint32 X[16]; /* Convert the uint8 data to uint32 LE */ - uint32 *px = (uint32 *)data; + const uint32 *px = (const uint32 *)data; for (uint i = 0; i < 16; i++) { X[i] = TO_LE32(*px); px++; @@ -306,17 +306,18 @@ void Md5::Finish(uint8 digest[16]) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; uint8 data[8]; - uint i; /* Save the length before padding. */ - for (i = 0; i < 8; ++i) + for (uint i = 0; i < 8; ++i) { data[i] = (uint8)(this->count[i >> 2] >> ((i & 3) << 3)); + } /* Pad to 56 bytes mod 64. */ this->Append(pad, ((55 - (this->count[0] >> 3)) & 63) + 1); /* Append the length. */ this->Append(data, 8); - for (i = 0; i < 16; ++i) + for (uint i = 0; i < 16; ++i) { digest[i] = (uint8)(this->abcd[i >> 2] >> ((i & 3) << 3)); + } } diff --git a/src/3rdparty/md5/md5.h b/src/3rdparty/md5/md5.h index a3c4a6d9f..9748dc444 100644 --- a/src/3rdparty/md5/md5.h +++ b/src/3rdparty/md5/md5.h @@ -55,16 +55,6 @@ #ifndef MD5_INCLUDED #define MD5_INCLUDED -/* - * This package supports both compile-time and run-time determination of CPU - * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be - * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is - * defined as non-zero, the code will be compiled to run only on big-endian - * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to - * run on either big- or little-endian CPUs, but will run slightly less - * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. - */ - struct Md5 { private: uint32 count[2]; ///< message length in bits, lsw first |