/*****************************************************************************
* md5.js
*
* A JavaScript implementation of the RSA Data Security, Inc. MD5
* Message-Digest Algorithm.
*
* Copyright (C) Paul Johnston 1999. Distributed under the LGPL.
*****************************************************************************/
/* to convert strings to a list of ascii values */
var sAscii = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var sAscii = sAscii + "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
/* convert integer to hex string */
var sHex = "0123456789ABCDEF";
function hex(i) {
h = "";
for(j = 0; j <= 3; j++) {
h += sHex.charAt((i >> (j * 8 + 4)) & 0x0F) +
sHex.charAt((i >> (j * 8)) & 0x0F);
}
return h;
}
/* add, handling overflows correctly */
function add(x, y) {
return ((x&0x7FFFFFFF) + (y&0x7FFFFFFF)) ^ (x&0x80000000) ^ (y&0x80000000);
}
/* MD5 rounds functions */
function R1(A, B, C, D, X, S, T) {
q = add(add(A, (B & C) | (~B & D)), add(X, T));
return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
}
function R2(A, B, C, D, X, S, T) {
q = add(add(A, (B & D) | (C & ~D)), add(X, T));
return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
}
function R3(A, B, C, D, X, S, T) {
q = add(add(A, B ^ C ^ D), add(X, T));
return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
}
function R4(A, B, C, D, X, S, T) {
q = add(add(A, C ^ (B | ~D)), add(X, T));
return add((q << S) | ((q >> (32 - S)) & (Math.pow(2, S) - 1)), B);
}
/* main entry point */
function calcMD5(sInp) {
/* Calculate length in machine words, including padding */
¶ÔÓÚJavaScriptÀ´½²£¬ËüµÄ³öÏÖʹµÃÐÅÏ¢ºÍÓû§Ö®¼ä²»½öÖ»ÊÇÒ»ÖÖÏÔʾºÍä¯ÀÀµÄ¹Øϵ£¬¶øÊÇʵÏÖÁËÒ»ÖÖʵʱµÄ¡¢¶¯Ì¬µÄ¡¢¿É½»Ê½µÄ±í´ïÄÜÁ¦¡£×î½üС±àÕûÀíÁËһЩ×ÊÁÏ£¬·¢²¼ÉÏÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¬Èç¹ûÎÄÕÂÓÐʲô覴û¹Ï£Íû¸ßÊÖÖ¸µã£¬´ó¼ÒÏ໥ѧϰ¡£
JavaScriptÊÇÒ»ÖÖ»ùÓÚ¶ÔÏó(Object)ºÍʼþÇý¶¯(Event Driven)²¢¾ßÓа²È«ÐÔÄܵĽű¾Óï ......
ÃèÊö event´ú±íʼþµÄ״̬£¬ÀýÈç´¥·¢event¶ÔÏóµÄÔªËØ¡¢Êó±êµÄλÖü°×´Ì¬¡¢°´ÏµļüµÈµÈ¡£ event¶ÔÏóÖ»ÔÚʼþ·¢ÉúµÄ¹ý³ÌÖвÅÓÐЧ¡£ eventµÄijЩÊôÐÔÖ»¶ÔÌض¨µÄʼþÓÐÒâÒå¡£±ÈÈ磬fromElement ºÍ toElement ÊôÐÔÖ»¶Ô onmouseover ºÍ onmouseout ʼþÓÐÒâÒå¡£ Àý×Ó ÏÂÃæµÄÀý×Ó¼ì²éÊó±êÊÇ·ñÔÚÁ´½ÓÉ ......