diff options
Diffstat (limited to 'src/md5.cpp')
-rw-r--r-- | src/md5.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/md5.cpp b/src/md5.cpp index abf4bfa..46ee769 100644 --- a/src/md5.cpp +++ b/src/md5.cpp | |||
@@ -13,29 +13,7 @@ | |||
13 | 13 | ||
14 | 14 | ||
15 | // This performs a wrapping bitwise shift, kinda' fun! | 15 | // This performs a wrapping bitwise shift, kinda' fun! |
16 | 16 | #define bitRoll( val, amnt ) ((val<<(amnt)) | (val>>(32-(amnt)))) | |
17 | #define bit_roll( num, cnt ) \ | ||
18 | (((num) << (cnt)) | (((num) >> (32 - (cnt))) & ~(-1<<(cnt)))) | ||
19 | |||
20 | //#define md5_cmn( q, a, b, x, s, t ) (bit_roll((a + q + x + t), s) + b) | ||
21 | |||
22 | // The following are handy wrappers for the cmn function | ||
23 | #define md5_ff( a, b, c, d, x, s, t ) \ | ||
24 | (md5_cmn((b & c) | ((~b) & d), a, b, x, s, t)) | ||
25 | |||
26 | #define md5_gg( a, b, c, d, x, s, t ) \ | ||
27 | (md5_cmn((b & d) | (c & (~d)), a, b, x, s, t)) | ||
28 | |||
29 | #define md5_hh( a, b, c, d, x, s, t ) \ | ||
30 | (md5_cmn(b ^ c ^ d, a, b, x, s, t)) | ||
31 | |||
32 | #define md5_ii( a, b, c, d, x, s, t ) \ | ||
33 | (md5_cmn(c ^ (b | (~d)), a, b, x, s, t)) | ||
34 | |||
35 | inline long md5_cmn( long q, long a, long b, long x, long s, long t ) | ||
36 | { | ||
37 | return bit_roll((a + q + x + t), s) + b; | ||
38 | } | ||
39 | 17 | ||
40 | Bu::Md5::Md5() | 18 | Bu::Md5::Md5() |
41 | { | 19 | { |
@@ -50,10 +28,10 @@ void Bu::Md5::reset() | |||
50 | { | 28 | { |
51 | // These are the magic seed numbers... | 29 | // These are the magic seed numbers... |
52 | 30 | ||
53 | sum[0] = 1732584193; | 31 | sum[0] = 0x67452301U; |
54 | sum[1] = -271733879; | 32 | sum[1] = 0xEFCDAB89U; |
55 | sum[2] = -1732584194; | 33 | sum[2] = 0x98BADCFEU; |
56 | sum[3] = 271733878; | 34 | sum[3] = 0x10325476U; |
57 | 35 | ||
58 | iBytes = 0; | 36 | iBytes = 0; |
59 | memset( inbuf, 0, 4*16 ); | 37 | memset( inbuf, 0, 4*16 ); |