OLD | NEW |
1 // This is mozilla/security/manager/ssl/src/md4.c, CVS rev. 1.1, with trivial | 1 // This is mozilla/security/manager/ssl/src/md4.c, CVS rev. 1.1, with trivial |
2 // changes to port it to our source tree. | 2 // changes to port it to our source tree. |
3 // | 3 // |
4 // WARNING: MD4 is cryptographically weak. Do not use MD4 except in NTLM | 4 // WARNING: MD4 is cryptographically weak. Do not use MD4 except in NTLM |
5 // authentication. | 5 // authentication. |
6 | 6 |
7 /* vim:set ts=2 sw=2 et cindent: */ | 7 /* vim:set ts=2 sw=2 et cindent: */ |
8 /* ***** BEGIN LICENSE BLOCK ***** | 8 /* ***** BEGIN LICENSE BLOCK ***** |
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
10 * | 10 * |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 * ***** END LICENSE BLOCK ***** */ | 42 * ***** END LICENSE BLOCK ***** */ |
43 | 43 |
44 /* | 44 /* |
45 * "clean room" MD4 implementation (see RFC 1320) | 45 * "clean room" MD4 implementation (see RFC 1320) |
46 */ | 46 */ |
47 | 47 |
48 #include "net/http/md4.h" | 48 #include "net/http/md4.h" |
49 | 49 |
50 #include <string.h> | 50 #include <string.h> |
51 | 51 |
52 typedef uint32 Uint32; | 52 typedef uint32_t Uint32; |
53 typedef uint8 Uint8; | 53 typedef uint8_t Uint8; |
54 | 54 |
55 /* the "conditional" function */ | 55 /* the "conditional" function */ |
56 #define F(x,y,z) (((x) & (y)) | (~(x) & (z))) | 56 #define F(x,y,z) (((x) & (y)) | (~(x) & (z))) |
57 | 57 |
58 /* the "majority" function */ | 58 /* the "majority" function */ |
59 #define G(x,y,z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) | 59 #define G(x,y,z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) |
60 | 60 |
61 /* the "parity" function */ | 61 /* the "parity" function */ |
62 #define H(x,y,z) ((x) ^ (y) ^ (z)) | 62 #define H(x,y,z) ((x) ^ (y) ^ (z)) |
63 | 63 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 md4step(state, final); | 175 md4step(state, final); |
176 if (n >= 56) | 176 if (n >= 56) |
177 md4step(state, final + 64); | 177 md4step(state, final + 64); |
178 | 178 |
179 /* copy state to result */ | 179 /* copy state to result */ |
180 w2b(result, state, 16); | 180 w2b(result, state, 16); |
181 } | 181 } |
182 | 182 |
183 } // namespace net::weak_crypto | 183 } // namespace net::weak_crypto |
184 } // namespace net | 184 } // namespace net |
OLD | NEW |