MD5.js
10.0 KB
!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.t=o,this.i=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.t[this.i+i>>>2]|=e<<24-(this.i+i)%4*8}else for(i=0;i<r;i+=4)this.t[this.i+i>>>2]=t[i>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.j="number"==typeof t?t:0},n.prototype.A=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.O=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.h,u=e/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,a=Math.min(4*f,e);if(f){for(var c=0;c<f;c+=o)this.I(r,c);t=r.splice(0,f),this.l.nSigBytes-=a}return new i.e(t,a)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.A(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.A(n),this._()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype._=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var i={};return function(){r.r(i),r.d(i,{MD5:function(){return h}});var n,t=r(3354),e=r(1868),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),u=[];function f(n,t,r,i,e,o,u){var f=n+(t&r|~t&i)+e+u;return(f<<o|f>>>32-o)+t}function a(n,t,r,i,e,o,u){var f=n+(t&i|r&~i)+e+u;return(f<<o|f>>>32-o)+t}function c(n,t,r,i,e,o,u){var f=n+(t^r^i)+e+u;return(f<<o|f>>>32-o)+t}function s(n,t,r,i,e,o,u){var f=n+(r^(t|~i))+e+u;return(f<<o|f>>>32-o)+t}!function(){for(var n=0;n<64;n++)u[n]=4294967296*Math.abs(Math.sin(n+1))|0}();var h=function(n){function r(r){var i=n.call(this,r)||this;return i.N=new t.e([1732584193,4023233417,2562383102,271733878]),r&&void 0!==r.hash&&(i.N=r.hash.clone()),i}return o(r,n),r.prototype.U=function(){this.N=new t.e([1732584193,4023233417,2562383102,271733878])},r.prototype.I=function(n,t){for(var r=0;r<16;r++){var i=t+r,e=n[i];n[i]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}var o=this.N.words,h=n[t],v=n[t+1],d=n[t+2],w=n[t+3],l=n[t+4],y=n[t+5],b=n[t+6],p=n[t+7],m=n[t+8],g=n[t+9],j=n[t+10],A=n[t+11],M=n[t+12],O=n[t+13],I=n[t+14],E=n[t+15],U=o[0],_=o[1],S=o[2],N=o[3];U=f(U,_,S,N,h,7,u[0]),N=f(N,U,_,S,v,12,u[1]),S=f(S,N,U,_,d,17,u[2]),_=f(_,S,N,U,w,22,u[3]),U=f(U,_,S,N,l,7,u[4]),N=f(N,U,_,S,y,12,u[5]),S=f(S,N,U,_,b,17,u[6]),_=f(_,S,N,U,p,22,u[7]),U=f(U,_,S,N,m,7,u[8]),N=f(N,U,_,S,g,12,u[9]),S=f(S,N,U,_,j,17,u[10]),_=f(_,S,N,U,A,22,u[11]),U=f(U,_,S,N,M,7,u[12]),N=f(N,U,_,S,O,12,u[13]),S=f(S,N,U,_,I,17,u[14]),U=a(U,_=f(_,S,N,U,E,22,u[15]),S,N,v,5,u[16]),N=a(N,U,_,S,b,9,u[17]),S=a(S,N,U,_,A,14,u[18]),_=a(_,S,N,U,h,20,u[19]),U=a(U,_,S,N,y,5,u[20]),N=a(N,U,_,S,j,9,u[21]),S=a(S,N,U,_,E,14,u[22]),_=a(_,S,N,U,l,20,u[23]),U=a(U,_,S,N,g,5,u[24]),N=a(N,U,_,S,I,9,u[25]),S=a(S,N,U,_,w,14,u[26]),_=a(_,S,N,U,m,20,u[27]),U=a(U,_,S,N,O,5,u[28]),N=a(N,U,_,S,d,9,u[29]),S=a(S,N,U,_,p,14,u[30]),U=c(U,_=a(_,S,N,U,M,20,u[31]),S,N,y,4,u[32]),N=c(N,U,_,S,m,11,u[33]),S=c(S,N,U,_,A,16,u[34]),_=c(_,S,N,U,I,23,u[35]),U=c(U,_,S,N,v,4,u[36]),N=c(N,U,_,S,l,11,u[37]),S=c(S,N,U,_,p,16,u[38]),_=c(_,S,N,U,j,23,u[39]),U=c(U,_,S,N,O,4,u[40]),N=c(N,U,_,S,h,11,u[41]),S=c(S,N,U,_,w,16,u[42]),_=c(_,S,N,U,b,23,u[43]),U=c(U,_,S,N,g,4,u[44]),N=c(N,U,_,S,M,11,u[45]),S=c(S,N,U,_,E,16,u[46]),U=s(U,_=c(_,S,N,U,d,23,u[47]),S,N,h,6,u[48]),N=s(N,U,_,S,p,10,u[49]),S=s(S,N,U,_,I,15,u[50]),_=s(_,S,N,U,y,21,u[51]),U=s(U,_,S,N,M,6,u[52]),N=s(N,U,_,S,w,10,u[53]),S=s(S,N,U,_,j,15,u[54]),_=s(_,S,N,U,v,21,u[55]),U=s(U,_,S,N,m,6,u[56]),N=s(N,U,_,S,E,10,u[57]),S=s(S,N,U,_,b,15,u[58]),_=s(_,S,N,U,O,21,u[59]),U=s(U,_,S,N,l,6,u[60]),N=s(N,U,_,S,A,10,u[61]),S=s(S,N,U,_,d,15,u[62]),_=s(_,S,N,U,g,21,u[63]),o[0]=o[0]+U|0,o[1]=o[1]+_|0,o[2]=o[2]+S|0,o[3]=o[3]+N|0},r.prototype._=function(){var n=this.l,t=n.words,r=8*this.j,i=8*n.nSigBytes;t[i>>>5]|=128<<24-i%32;var e=Math.floor(r/4294967296),o=r;t[15+(i+64>>>9<<4)]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),t[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n.nSigBytes=4*(t.length+1),this.O();for(var u=this.N,f=u.words,a=0;a<4;a++){var c=f[a];f[a]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return u},r.prototype.clone=function(){return new r({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.j})},r.hash=function(n){return(new r).finalize(n)},r}(e.P)}(),i}()}));