w_md5.min.js 3.7 KB

1
  1. function hex_md5(r,n){function a(r,n){return r<<n|r>>>32-n}function i(r,n){var t=2147483648&r,e=2147483648&n,o=1073741824&r,u=1073741824&n,r=(1073741823&r)+(1073741823&n);return o&u?2147483648^r^t^e:o|u?1073741824&r?3221225472^r^t^e:1073741824^r^t^e:r^t^e}function t(r,n,t,e,o,u,f){return r=i(r,i(i(n&t|~n&e,o),f)),i(a(r,u),n)}function e(r,n,t,e,o,u,f){return r=i(r,i(i(n&e|t&~e,o),f)),i(a(r,u),n)}function o(r,n,t,e,o,u,f){return r=i(r,i(i(n^t^e,o),f)),i(a(r,u),n)}function u(r,n,t,e,o,u,f){return r=i(r,i(i(t^(n|~e),o),f)),i(a(r,u),n)}function f(r){for(var n="",t="",e=0;e<=3;e++)n+=(t="0"+(r>>>8*e&255).toString(16)).substr(t.length-2,2);return n}Array();for(var h,c,d,C,m=function(r){for(var n,t=r.length,e=16*(1+((e=t+8)-e%64)/64),o=Array(e-1),u=0,f=0;f<t;)u=f%4*8,o[n=(f-f%4)/4]=o[n]|r.charCodeAt(f)<<u,f++;return o[n=(f-f%4)/4]=o[n]|128<<(u=f%4*8),o[e-2]=t<<3,o[e-1]=t>>>29,o}(r=function(r){r=r.replace(/\r\n/g,"\n");for(var n="",t=0;t<r.length;t++){var e=r.charCodeAt(t);e<128?n+=String.fromCharCode(e):n=127<e&&e<2048?(n+=String.fromCharCode(e>>6|192))+String.fromCharCode(63&e|128):(n=(n+=String.fromCharCode(e>>12|224))+String.fromCharCode(e>>6&63|128))+String.fromCharCode(63&e|128)}return n}(r)),_=1732584193,g=4023233417,p=2562383102,x=271733878,v=0;v<m.length;v+=16)_=t(h=_,c=g,d=p,C=x,m[v+0],7,3614090360),x=t(x,_,g,p,m[v+1],12,3905402710),p=t(p,x,_,g,m[v+2],17,606105819),g=t(g,p,x,_,m[v+3],22,3250441966),_=t(_,g,p,x,m[v+4],7,4118548399),x=t(x,_,g,p,m[v+5],12,1200080426),p=t(p,x,_,g,m[v+6],17,2821735955),g=t(g,p,x,_,m[v+7],22,4249261313),_=t(_,g,p,x,m[v+8],7,1770035416),x=t(x,_,g,p,m[v+9],12,2336552879),p=t(p,x,_,g,m[v+10],17,4294925233),g=t(g,p,x,_,m[v+11],22,2304563134),_=t(_,g,p,x,m[v+12],7,1804603682),x=t(x,_,g,p,m[v+13],12,4254626195),p=t(p,x,_,g,m[v+14],17,2792965006),_=e(_,g=t(g,p,x,_,m[v+15],22,1236535329),p,x,m[v+1],5,4129170786),x=e(x,_,g,p,m[v+6],9,3225465664),p=e(p,x,_,g,m[v+11],14,643717713),g=e(g,p,x,_,m[v+0],20,3921069994),_=e(_,g,p,x,m[v+5],5,3593408605),x=e(x,_,g,p,m[v+10],9,38016083),p=e(p,x,_,g,m[v+15],14,3634488961),g=e(g,p,x,_,m[v+4],20,3889429448),_=e(_,g,p,x,m[v+9],5,568446438),x=e(x,_,g,p,m[v+14],9,3275163606),p=e(p,x,_,g,m[v+3],14,4107603335),g=e(g,p,x,_,m[v+8],20,1163531501),_=e(_,g,p,x,m[v+13],5,2850285829),x=e(x,_,g,p,m[v+2],9,4243563512),p=e(p,x,_,g,m[v+7],14,1735328473),_=o(_,g=e(g,p,x,_,m[v+12],20,2368359562),p,x,m[v+5],4,4294588738),x=o(x,_,g,p,m[v+8],11,2272392833),p=o(p,x,_,g,m[v+11],16,1839030562),g=o(g,p,x,_,m[v+14],23,4259657740),_=o(_,g,p,x,m[v+1],4,2763975236),x=o(x,_,g,p,m[v+4],11,1272893353),p=o(p,x,_,g,m[v+7],16,4139469664),g=o(g,p,x,_,m[v+10],23,3200236656),_=o(_,g,p,x,m[v+13],4,681279174),x=o(x,_,g,p,m[v+0],11,3936430074),p=o(p,x,_,g,m[v+3],16,3572445317),g=o(g,p,x,_,m[v+6],23,76029189),_=o(_,g,p,x,m[v+9],4,3654602809),x=o(x,_,g,p,m[v+12],11,3873151461),p=o(p,x,_,g,m[v+15],16,530742520),_=u(_,g=o(g,p,x,_,m[v+2],23,3299628645),p,x,m[v+0],6,4096336452),x=u(x,_,g,p,m[v+7],10,1126891415),p=u(p,x,_,g,m[v+14],15,2878612391),g=u(g,p,x,_,m[v+5],21,4237533241),_=u(_,g,p,x,m[v+12],6,1700485571),x=u(x,_,g,p,m[v+3],10,2399980690),p=u(p,x,_,g,m[v+10],15,4293915773),g=u(g,p,x,_,m[v+1],21,2240044497),_=u(_,g,p,x,m[v+8],6,1873313359),x=u(x,_,g,p,m[v+15],10,4264355552),p=u(p,x,_,g,m[v+6],15,2734768916),g=u(g,p,x,_,m[v+13],21,1309151649),_=u(_,g,p,x,m[v+4],6,4149444226),x=u(x,_,g,p,m[v+11],10,3174756917),p=u(p,x,_,g,m[v+2],15,718787259),g=u(g,p,x,_,m[v+9],21,3951481745),_=i(_,h),g=i(g,c),p=i(p,d),x=i(x,C);return(32==n?f(_)+f(g)+f(p)+f(x):f(g)+f(p)).toLowerCase()}function createWMd5(){var r={hex_md5_16:function(r){return hex_md5(r,16)},hex_md5_16Upper:function(r){return hex_md5(r,16).toUpperCase()},hex_md5_32:function(r){return hex_md5(r,32)},hex_md5_32Upper:function(r){return hex_md5(r,32).toUpperCase()}};return r}