summaryrefslogtreecommitdiffstats
path: root/src/pedro/pedroutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pedro/pedroutil.cpp')
-rw-r--r--src/pedro/pedroutil.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pedro/pedroutil.cpp b/src/pedro/pedroutil.cpp
index 2197527fb..43ff9748d 100644
--- a/src/pedro/pedroutil.cpp
+++ b/src/pedro/pedroutil.cpp
@@ -650,7 +650,8 @@ DOMString Md5::finishHex()
//# The four core functions - F1 is optimized somewhat
-// #define F1(x, y, z) (x & y | ~x & z)
+// #define F1(x, y, z) (x & y | ~x & z)
+#define M(x) ((x) &= 0xffffffff)
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
@@ -658,7 +659,7 @@ DOMString Md5::finishHex()
// ## This is the central step in the MD5 algorithm.
#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+ ( w += (f(x, y, z) + data), M(w), w = w<<s | w>>(32-s), w += x, M(w) )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to