/ * MD5 Message-Digest Algorithm - JavaScript 'Modification History:' 1.0 16-Feb-2001 - Phil Fresle (Sales@frez.co.uk) - Initial Version (VB / ASP CODE) '1.0 21-Feb-2001 - Enrico Mosanghini (erik504@yahoo.com) - JavaScript porting * / function MD5 (sMessage) {function RotateLeft (lValue, iShiftBits) {return (lValue << iShiftBits) | (lValue >>> (32-iShiftBits));} function AddUnsigned (LX, LY) {VAR LX4, LY4, LX8, LY8, LRESULT; LX8 = (LX & 0x800000); LY8 = (Ly & 0x80000000); LX4 = (LX & 0x400000); LY4 = (LRESULT = (LX & 0x3ffffffff) (Ly & 0x3fffffff); if (LResult ^ 0x80000000 ^ LX8 ^ LY8); if (LX4 | LY4) {IF (LRESULT & 0X40000000) Return (LRESULT ^ 0xc0000000 ^ LX8 ^ LY8); Else Return (LRESULT ^ 0x400000 ^ lx8 ^ LY8);} else return (LRESULT ^ LX8 ^ ^;} Function F (x, y, z) {return (x & y) | ((~ x) & Z);} Function G (X, Y, Z) {Return (X & Z) | (Y & (~ Z));} Function H (x, y, z) {RETURN (x ^ y ^ z) Function I (X, Y, Z) {RETURN (Y ^ (x | (~ z)));} Function FF (A, B, C, D, X, S, AC) {A = AD Dunsigned (A, AddunSigned (AddunSigned (f (B, C, D), X), AC); Return AddUnsigned (Rotateleft (A, S), B);} Function GG (A, B, C, D, X , S, AC) {a = addunsigned (A, addunsigned (g (b, c, d), x), AC)); Return AddUnsigned (RotateLeft (A, S), B);} function hh (a , B, C, D, X, S, AC) {a = addunsigned (A, AddunSigned (addunsigned (H (B, C, D), X), AC); Return AddUnsigned (RotateLeft (A, S), b);} Function II (A, B, C, D, X, S, AC) {a = addunsigned (A, AddunSigned (addunsigned (i (B, C, D), X), AC); Return AddUnsigned (RotateLeft (A, S), B);} Function ConvertToWordArray (SMESSAGE) {var LWordCount; var LMessageLength = SMESSAGE.LENGTH; var lnumberofwords_temp1 =
lMessageLength 8; var lNumberOfWords_temp2 = (lNumberOfWords_temp1- (lNumberOfWords_temp1% 64)) / 64; var lNumberOfWords = (lNumberOfWords_temp2 1) * 16; var lWordArray = Array (lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while (lByteCount
K