MD5算法类,用于对密码及重要信息进行加密 using System; using System.Collections; using System.IO; namespace MD5 { /// <summary> /// MD5加密算法类 /// </summary> public class MD5 { private static UInt32 A; private static UInt32 B; private static UInt32 C; private static UInt32 D; private const int S11 = 7; private const int S12 = 12; private const int S13 = 17; private const int S14 = 22; private const int S21 = 5; private const int S22 = 9; private const int S23 = 14; private const int S24 = 20; private const int S31 = 4; private const int S32 = 11; private const int S33 = 16; private const int S34 = 23; private const int S41 = 6; private const int S42 = 10; private const int S43 = 15; private const int S44 = 21; private static UInt32 F(UInt32 x, UInt32 y, UInt32 z) { return (x & y) | ((~x) & z); } private static UInt32 G(UInt32 x, UInt32 y, UInt32 z) { return (x & z) | (y & (~z)); } private static UInt32 H(UInt32 x, UInt32 y, UInt32 z) { return x ^ y ^ z; } private static UInt32 I(UInt32 x, UInt32 y, UInt32 z) { return y ^ (x | (~z)); } private static void FF(ref UInt32 a, UInt32 b, UInt32 c, UInt32 d, UInt32 mj, int s, UInt32 ti) { a = a + F(b, c, d) + mj + ti; a = a << s | a >> (32 - s); a += b; } private static void GG(ref UInt32 a, UInt32 b, UInt32 c, UInt32 d, UInt32 mj, int s, UInt32 ti) { a = a + G(b, c, d) + mj + ti; a = a << s | a >> (32 - s); a += b; } private static void HH(ref UInt32 a, UInt32 b, UInt32 c, UInt32 d, UInt32 mj, int s, UInt32 ti) { a = a + H(b, c, d) + mj + ti; a = a << s | a >> (32 - s); a += b; } private static void II(ref UInt32 a, UInt32 b, UInt32 c, UInt32 d, UI