js-md5 0.9.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -1
- package/CHANGELOG.md +16 -0
- package/README.md +5 -4
- package/build/md5-lite.js +19 -7
- package/build/md5-lite.min.js +2 -2
- package/build/md5-lite.min.mjs +2 -2
- package/build/md5-lite.mjs +17 -7
- package/build/md5-lite.node.mjs +19 -7
- package/build/md5.js +36 -12
- package/build/md5.min.js +2 -2
- package/build/md5.min.mjs +2 -2
- package/build/md5.mjs +34 -12
- package/build/md5.modern.js +28 -10
- package/build/md5.modern.min.js +2 -2
- package/build/md5.modern.min.mjs +2 -2
- package/build/md5.modern.mjs +26 -10
- package/build/md5.modern.node.mjs +28 -10
- package/build/md5.node.mjs +36 -12
- package/index.d.ts +1 -1
- package/package.json +7 -1
- package/src/md5.js +37 -13
package/build/md5.min.mjs
CHANGED
|
@@ -3,8 +3,8 @@ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"de
|
|
|
3
3
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
4
4
|
*
|
|
5
5
|
* @namespace md5
|
|
6
|
-
* @version 0.
|
|
6
|
+
* @version 0.11.0
|
|
7
7
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
8
8
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/r=e,function(){var t="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(i=self);var h=!i.JS_MD5_NO_COMMON_JS&&r.exports,s=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,
|
|
10
|
+
*/r=e,function(){var t="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(i=self);var h=!i.JS_MD5_NO_COMMON_JS&&r.exports,s=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),a=[128,32768,8388608,-2147483648],o=[0,8,16,24],f=["hex","array","digest","arrayBuffer"];f.push("buffer"),f.push("base64");var u,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[];if(s){var c=new ArrayBuffer(68);u=new Uint8Array(c),p=new Uint32Array(c)}var l=Array.isArray;!i.JS_MD5_NO_NODE_JS&&l||(l=function(t){return"[object Array]"===Object.prototype.toString.call(t)});var d=s?ArrayBuffer.isView:null;!s||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&d||(d=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var b=function(r){var e=typeof r;if("string"===e)return[r,!0];if("object"!==e||null===r)throw new Error(t);if(s&&r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(l(r))return[r,!1];if(!s||!d(r))throw new Error(t);return[new Uint8Array(r.buffer,r.byteOffset,r.byteLength),!1]},v=function(t){return function(r){return new A(!0).update(r)[t]()}},w=function(t){return function(r,e){return new _(r,!0).update(e)[t]()}};function A(t){if(t)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=u;else if(s){var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function _(t,r){var e,i=b(t);if(t=i[0],i[1]){var h,s,n=[],a=t.length,o=0;for(e=0;e<a;++e)(h=t.charCodeAt(e))<128?n[o++]=h:h<2048?(n[o++]=192|h>>>6,n[o++]=128|63&h):h<55296||h>=57344?(n[o++]=224|h>>>12,n[o++]=128|h>>>6&63,n[o++]=128|63&h):h<56320&&(s=t.charCodeAt(e+1))>=56320&&s<57344?(++e,h=65536+((1023&h)<<10|1023&s),n[o++]=240|h>>>18,n[o++]=128|h>>>12&63,n[o++]=128|h>>>6&63,n[o++]=128|63&h):(n[o++]=239,n[o++]=191,n[o++]=189);t=n}t.length>64&&(t=new A(!0).update(t).array());var f=[],u=[];for(e=0;e<64;++e){var y=t[e]||0;f[e]=92^y,u[e]=54^y}A.call(this,r),this.update(u),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}A.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r=b(t);t=r[0];for(var e,i,h,n=r[1],a=0,f=t.length,u=this.blocks,y=this.buffer8;a<f;){if(this.hashed&&(this.hashed=!1,u[0]=u[16],u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),n)if(s)for(h=this.start;a<f&&h<64;++a)(e=t.charCodeAt(a))<128?y[h++]=e:e<2048?(y[h++]=192|e>>>6,y[h++]=128|63&e):e<55296||e>=57344?(y[h++]=224|e>>>12,y[h++]=128|e>>>6&63,y[h++]=128|63&e):e<56320&&(i=t.charCodeAt(a+1))>=56320&&i<57344?(++a,e=65536+((1023&e)<<10|1023&i),y[h++]=240|e>>>18,y[h++]=128|e>>>12&63,y[h++]=128|e>>>6&63,y[h++]=128|63&e):(y[h++]=239,y[h++]=191,y[h++]=189);else for(h=this.start;a<f&&h<64;++a)(e=t.charCodeAt(a))<128?u[h>>>2]|=e<<o[3&h++]:e<2048?(u[h>>>2]|=(192|e>>>6)<<o[3&h++],u[h>>>2]|=(128|63&e)<<o[3&h++]):e<55296||e>=57344?(u[h>>>2]|=(224|e>>>12)<<o[3&h++],u[h>>>2]|=(128|e>>>6&63)<<o[3&h++],u[h>>>2]|=(128|63&e)<<o[3&h++]):e<56320&&(i=t.charCodeAt(a+1))>=56320&&i<57344?(++a,e=65536+((1023&e)<<10|1023&i),u[h>>>2]|=(240|e>>>18)<<o[3&h++],u[h>>>2]|=(128|e>>>12&63)<<o[3&h++],u[h>>>2]|=(128|e>>>6&63)<<o[3&h++],u[h>>>2]|=(128|63&e)<<o[3&h++]):(u[h>>>2]|=239<<o[3&h++],u[h>>>2]|=191<<o[3&h++],u[h>>>2]|=189<<o[3&h++]);else if(s)for(h=this.start;a<f&&h<64;++a)y[h++]=t[a];else for(h=this.start;a<f&&h<64;++a)u[h>>>2]|=t[a]<<o[3&h++];this.lastByteIndex=h,this.bytes+=h-this.start,h>=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},A.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>>2]|=a[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},A.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?r=((r=((t=((t=n[0]-680876937)<<7|t>>>25)-271733879|0)^(e=((e=(-271733879^(i=((i=(-1732584194^2004318071&t)+n[1]-117830708)<<12|i>>>20)+t|0)&(-271733879^t))+n[2]-1126478375)<<17|e>>>15)+i|0)&(i^t))+n[3]-1316259209)<<22|r>>>10)+e|0:(t=this.h0,r=this.h1,e=this.h2,r=((r+=((t=((t+=((i=this.h3)^r&(e^i))+n[0]-680876936)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[1]-389564586)<<12|i>>>20)+t|0)&(t^r))+n[2]+606105819)<<17|e>>>15)+i|0)&(i^t))+n[3]-1044525330)<<22|r>>>10)+e|0),r=((r+=((t=((t+=(i^r&(e^i))+n[4]-176418897)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[5]+1200080426)<<12|i>>>20)+t|0)&(t^r))+n[6]-1473231341)<<17|e>>>15)+i|0)&(i^t))+n[7]-45705983)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[8]+1770035416)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[9]-1958414417)<<12|i>>>20)+t|0)&(t^r))+n[10]-42063)<<17|e>>>15)+i|0)&(i^t))+n[11]-1990404162)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[12]+1804603682)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[13]-40341101)<<12|i>>>20)+t|0)&(t^r))+n[14]-1502002290)<<17|e>>>15)+i|0)&(i^t))+n[15]+1236535329)<<22|r>>>10)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[1]-165796510)<<5|t>>>27)+r|0)^r))+n[6]-1069501632)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[11]+643717713)<<14|e>>>18)+i|0)^i))+n[0]-373897302)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[5]-701558691)<<5|t>>>27)+r|0)^r))+n[10]+38016083)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[15]-660478335)<<14|e>>>18)+i|0)^i))+n[4]-405537848)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[9]+568446438)<<5|t>>>27)+r|0)^r))+n[14]-1019803690)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[3]-187363961)<<14|e>>>18)+i|0)^i))+n[8]+1163531501)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[13]-1444681467)<<5|t>>>27)+r|0)^r))+n[2]-51403784)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[7]+1735328473)<<14|e>>>18)+i|0)^i))+n[12]-1926607734)<<20|r>>>12)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[5]-378558)<<4|t>>>28)+r|0))+n[8]-2022574463)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[11]+1839030562)<<16|e>>>16)+i|0))+n[14]-35309556)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[1]-1530992060)<<4|t>>>28)+r|0))+n[4]+1272893353)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[7]-155497632)<<16|e>>>16)+i|0))+n[10]-1094730640)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[13]+681279174)<<4|t>>>28)+r|0))+n[0]-358537222)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[3]-722521979)<<16|e>>>16)+i|0))+n[6]+76029189)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[9]-640364487)<<4|t>>>28)+r|0))+n[12]-421815835)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[15]+530742520)<<16|e>>>16)+i|0))+n[2]-995338651)<<23|r>>>9)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[0]-198630844)<<6|t>>>26)+r|0)|~e))+n[7]+1126891415)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[14]-1416354905)<<15|e>>>17)+i|0)|~t))+n[5]-57434055)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[12]+1700485571)<<6|t>>>26)+r|0)|~e))+n[3]-1894986606)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[10]-1051523)<<15|e>>>17)+i|0)|~t))+n[1]-2054922799)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[8]+1873313359)<<6|t>>>26)+r|0)|~e))+n[15]-30611744)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[6]-1560198380)<<15|e>>>17)+i|0)|~t))+n[13]+1309151649)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[4]-145523070)<<6|t>>>26)+r|0)|~e))+n[11]-1120210379)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[2]+718787259)<<15|e>>>17)+i|0)|~t))+n[9]-343485551)<<21|r>>>11)+e|0,this.first?(this.h0=t+1732584193|0,this.h1=r-271733879|0,this.h2=e-1732584194|0,this.h3=i+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+r|0,this.h2=this.h2+e|0,this.h3=this.h3+i|0)},A.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return n[t>>>4&15]+n[15&t]+n[t>>>12&15]+n[t>>>8&15]+n[t>>>20&15]+n[t>>>16&15]+n[t>>>28&15]+n[t>>>24&15]+n[r>>>4&15]+n[15&r]+n[r>>>12&15]+n[r>>>8&15]+n[r>>>20&15]+n[r>>>16&15]+n[r>>>28&15]+n[r>>>24&15]+n[e>>>4&15]+n[15&e]+n[e>>>12&15]+n[e>>>8&15]+n[e>>>20&15]+n[e>>>16&15]+n[e>>>28&15]+n[e>>>24&15]+n[i>>>4&15]+n[15&i]+n[i>>>12&15]+n[i>>>8&15]+n[i>>>20&15]+n[i>>>16&15]+n[i>>>28&15]+n[i>>>24&15]},A.prototype.toString=A.prototype.hex,A.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&i,i>>>8&255,i>>>16&255,i>>>24&255]},A.prototype.array=A.prototype.digest,A.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},A.prototype.buffer=A.prototype.arrayBuffer,A.prototype.base64=function(){for(var t,r,e,i="",h=this.array(),s=0;s<15;)t=h[s++],r=h[s++],e=h[s++],i+=y[t>>>2]+y[63&(t<<4|r>>>4)]+y[63&(r<<2|e>>>6)]+y[63&e];return t=h[s],i+=y[t>>>2]+y[t<<4&63]+"=="},_.prototype=new A,_.prototype.finalize=function(){if(A.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();A.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(t),A.prototype.finalize.call(this)}};var B=function(){var t=v("hex");t.create=function(){return new A},t.update=function(r){return t.create().update(r)};for(var r=0;r<f.length;++r){var e=f[r];t[e]=v(e)}return t}();B.md5=B,B.md5.hmac=function(){var t=w("hex");t.create=function(t){return new _(t)},t.update=function(r,e){return t.create(r).update(e)};for(var r=0;r<f.length;++r){var e=f[r];t[e]=w(e)}return t}(),h?r.exports=B:i.md5=B}();var i=t(e.exports);export{i as default,i as md5};
|
package/build/md5.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var md5$1 = {exports: {}};
|
|
|
8
8
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
9
9
|
*
|
|
10
10
|
* @namespace md5
|
|
11
|
-
* @version 0.
|
|
11
|
+
* @version 0.11.0
|
|
12
12
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
13
13
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
14
14
|
* @license MIT
|
|
@@ -61,7 +61,7 @@ var md5$1 = {exports: {}};
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
var isView = ArrayBuffer.isView;
|
|
64
|
+
var isView = ARRAY_BUFFER ? ArrayBuffer.isView : null;
|
|
65
65
|
/* istanbul ignore else */
|
|
66
66
|
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !isView)) {
|
|
67
67
|
isView = function (obj) {
|
|
@@ -81,10 +81,14 @@ var md5$1 = {exports: {}};
|
|
|
81
81
|
if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
82
82
|
return [new Uint8Array(message), false];
|
|
83
83
|
}
|
|
84
|
-
if (
|
|
84
|
+
if (isArray(message)) {
|
|
85
|
+
return [message, false];
|
|
86
|
+
}
|
|
87
|
+
if (!ARRAY_BUFFER || !isView(message)) {
|
|
85
88
|
throw new Error(INPUT_ERROR);
|
|
86
89
|
}
|
|
87
|
-
|
|
90
|
+
// read the underlying bytes of any view (DataView, Uint16Array, ...)
|
|
91
|
+
return [new Uint8Array(message.buffer, message.byteOffset, message.byteLength), false];
|
|
88
92
|
};
|
|
89
93
|
|
|
90
94
|
/**
|
|
@@ -340,7 +344,7 @@ var md5$1 = {exports: {}};
|
|
|
340
344
|
var result = formatMessage(message);
|
|
341
345
|
message = result[0];
|
|
342
346
|
var isString = result[1];
|
|
343
|
-
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
|
347
|
+
var code, code2, index = 0, i, length = message.length, blocks = this.blocks;
|
|
344
348
|
var buffer8 = this.buffer8;
|
|
345
349
|
|
|
346
350
|
while (index < length) {
|
|
@@ -366,12 +370,18 @@ var md5$1 = {exports: {}};
|
|
|
366
370
|
buffer8[i++] = 0xe0 | (code >>> 12);
|
|
367
371
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
368
372
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
369
|
-
} else {
|
|
370
|
-
|
|
373
|
+
} else if (code < 0xdc00 && (code2 = message.charCodeAt(index + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
374
|
+
++index;
|
|
375
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
371
376
|
buffer8[i++] = 0xf0 | (code >>> 18);
|
|
372
377
|
buffer8[i++] = 0x80 | ((code >>> 12) & 0x3f);
|
|
373
378
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
374
379
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
380
|
+
} else {
|
|
381
|
+
// unpaired surrogate: U+FFFD
|
|
382
|
+
buffer8[i++] = 0xef;
|
|
383
|
+
buffer8[i++] = 0xbf;
|
|
384
|
+
buffer8[i++] = 0xbd;
|
|
375
385
|
}
|
|
376
386
|
}
|
|
377
387
|
} else {
|
|
@@ -386,12 +396,18 @@ var md5$1 = {exports: {}};
|
|
|
386
396
|
blocks[i >>> 2] |= (0xe0 | (code >>> 12)) << SHIFT[i++ & 3];
|
|
387
397
|
blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3];
|
|
388
398
|
blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
|
389
|
-
} else {
|
|
390
|
-
|
|
399
|
+
} else if (code < 0xdc00 && (code2 = message.charCodeAt(index + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
400
|
+
++index;
|
|
401
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
391
402
|
blocks[i >>> 2] |= (0xf0 | (code >>> 18)) << SHIFT[i++ & 3];
|
|
392
403
|
blocks[i >>> 2] |= (0x80 | ((code >>> 12) & 0x3f)) << SHIFT[i++ & 3];
|
|
393
404
|
blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3];
|
|
394
405
|
blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
|
406
|
+
} else {
|
|
407
|
+
// unpaired surrogate: U+FFFD
|
|
408
|
+
blocks[i >>> 2] |= 0xef << SHIFT[i++ & 3];
|
|
409
|
+
blocks[i >>> 2] |= 0xbf << SHIFT[i++ & 3];
|
|
410
|
+
blocks[i >>> 2] |= 0xbd << SHIFT[i++ & 3];
|
|
395
411
|
}
|
|
396
412
|
}
|
|
397
413
|
}
|
|
@@ -774,7 +790,7 @@ var md5$1 = {exports: {}};
|
|
|
774
790
|
var i, result = formatMessage(key);
|
|
775
791
|
key = result[0];
|
|
776
792
|
if (result[1]) {
|
|
777
|
-
var bytes = [], length = key.length, index = 0, code;
|
|
793
|
+
var bytes = [], length = key.length, index = 0, code, code2;
|
|
778
794
|
for (i = 0; i < length; ++i) {
|
|
779
795
|
code = key.charCodeAt(i);
|
|
780
796
|
if (code < 0x80) {
|
|
@@ -786,12 +802,18 @@ var md5$1 = {exports: {}};
|
|
|
786
802
|
bytes[index++] = (0xe0 | (code >>> 12));
|
|
787
803
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
788
804
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
789
|
-
} else {
|
|
790
|
-
|
|
805
|
+
} else if (code < 0xdc00 && (code2 = key.charCodeAt(i + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
806
|
+
++i;
|
|
807
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
791
808
|
bytes[index++] = (0xf0 | (code >>> 18));
|
|
792
809
|
bytes[index++] = (0x80 | ((code >>> 12) & 0x3f));
|
|
793
810
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
794
811
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
812
|
+
} else {
|
|
813
|
+
// unpaired surrogate: U+FFFD
|
|
814
|
+
bytes[index++] = 0xef;
|
|
815
|
+
bytes[index++] = 0xbf;
|
|
816
|
+
bytes[index++] = 0xbd;
|
|
795
817
|
}
|
|
796
818
|
}
|
|
797
819
|
key = bytes;
|
package/build/md5.modern.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
3
3
|
*
|
|
4
4
|
* @namespace md5
|
|
5
|
-
* @version 0.
|
|
5
|
+
* @version 0.11.0
|
|
6
6
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
7
7
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
8
8
|
* @license MIT
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
var isArray = Array.isArray;
|
|
51
51
|
|
|
52
|
-
var isView = ArrayBuffer.isView;
|
|
52
|
+
var isView = ArrayBuffer.isView ;
|
|
53
53
|
|
|
54
54
|
// [message: string, isString: bool]
|
|
55
55
|
var formatMessage = function (message) {
|
|
@@ -63,10 +63,14 @@
|
|
|
63
63
|
if (message.constructor === ArrayBuffer) {
|
|
64
64
|
return [new Uint8Array(message), false];
|
|
65
65
|
}
|
|
66
|
-
if (
|
|
66
|
+
if (isArray(message)) {
|
|
67
|
+
return [message, false];
|
|
68
|
+
}
|
|
69
|
+
if (!isView(message)) {
|
|
67
70
|
throw new Error(INPUT_ERROR);
|
|
68
71
|
}
|
|
69
|
-
|
|
72
|
+
// read the underlying bytes of any view (DataView, Uint16Array, ...)
|
|
73
|
+
return [new Uint8Array(message.buffer, message.byteOffset, message.byteLength), false];
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
/**
|
|
@@ -182,6 +186,8 @@
|
|
|
182
186
|
throw new Error(INPUT_ERROR);
|
|
183
187
|
} else if (message.constructor === ArrayBuffer) {
|
|
184
188
|
message = new Uint8Array(message);
|
|
189
|
+
} else if (isView(message) && message.constructor !== Buffer) {
|
|
190
|
+
message = new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
|
|
185
191
|
}
|
|
186
192
|
}
|
|
187
193
|
if (isArray(message) || isView(message) ||
|
|
@@ -347,7 +353,7 @@
|
|
|
347
353
|
var result = formatMessage(message);
|
|
348
354
|
message = result[0];
|
|
349
355
|
var isString = result[1];
|
|
350
|
-
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
|
356
|
+
var code, code2, index = 0, i, length = message.length, blocks = this.blocks;
|
|
351
357
|
var buffer8 = this.buffer8;
|
|
352
358
|
|
|
353
359
|
while (index < length) {
|
|
@@ -373,12 +379,18 @@
|
|
|
373
379
|
buffer8[i++] = 0xe0 | (code >>> 12);
|
|
374
380
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
375
381
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
376
|
-
} else {
|
|
377
|
-
|
|
382
|
+
} else if (code < 0xdc00 && (code2 = message.charCodeAt(index + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
383
|
+
++index;
|
|
384
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
378
385
|
buffer8[i++] = 0xf0 | (code >>> 18);
|
|
379
386
|
buffer8[i++] = 0x80 | ((code >>> 12) & 0x3f);
|
|
380
387
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
381
388
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
389
|
+
} else {
|
|
390
|
+
// unpaired surrogate: U+FFFD
|
|
391
|
+
buffer8[i++] = 0xef;
|
|
392
|
+
buffer8[i++] = 0xbf;
|
|
393
|
+
buffer8[i++] = 0xbd;
|
|
382
394
|
}
|
|
383
395
|
}
|
|
384
396
|
}
|
|
@@ -757,7 +769,7 @@
|
|
|
757
769
|
var i, result = formatMessage(key);
|
|
758
770
|
key = result[0];
|
|
759
771
|
if (result[1]) {
|
|
760
|
-
var bytes = [], length = key.length, index = 0, code;
|
|
772
|
+
var bytes = [], length = key.length, index = 0, code, code2;
|
|
761
773
|
for (i = 0; i < length; ++i) {
|
|
762
774
|
code = key.charCodeAt(i);
|
|
763
775
|
if (code < 0x80) {
|
|
@@ -769,12 +781,18 @@
|
|
|
769
781
|
bytes[index++] = (0xe0 | (code >>> 12));
|
|
770
782
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
771
783
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
772
|
-
} else {
|
|
773
|
-
|
|
784
|
+
} else if (code < 0xdc00 && (code2 = key.charCodeAt(i + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
785
|
+
++i;
|
|
786
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
774
787
|
bytes[index++] = (0xf0 | (code >>> 18));
|
|
775
788
|
bytes[index++] = (0x80 | ((code >>> 12) & 0x3f));
|
|
776
789
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
777
790
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
791
|
+
} else {
|
|
792
|
+
// unpaired surrogate: U+FFFD
|
|
793
|
+
bytes[index++] = 0xef;
|
|
794
|
+
bytes[index++] = 0xbf;
|
|
795
|
+
bytes[index++] = 0xbd;
|
|
778
796
|
}
|
|
779
797
|
}
|
|
780
798
|
key = bytes;
|
package/build/md5.modern.min.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
3
3
|
*
|
|
4
4
|
* @namespace md5
|
|
5
|
-
* @version 0.
|
|
5
|
+
* @version 0.11.0
|
|
6
6
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
7
7
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
8
8
|
* @license MIT
|
|
9
9
|
*/
|
|
10
|
-
!function(){var t="input is invalid type",r="object"==typeof window,e=r?window:{};e.JS_MD5_NO_WINDOW&&(r=!1);var i="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope,h=!e.JS_MD5_NO_NODE_JS&&!r&&"object"==typeof process&&process.versions&&process.versions.node;h?e=global:i&&(e=self);var s=!e.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,n="function"==typeof define&&define.amd,a="0123456789abcdef".split(""),o=[128,32768,8388608,-2147483648],f=["hex","array","digest","arrayBuffer"];f.push("buffer"),f.push("base64");var u,
|
|
10
|
+
!function(){var t="input is invalid type",r="object"==typeof window,e=r?window:{};e.JS_MD5_NO_WINDOW&&(r=!1);var i="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope,h=!e.JS_MD5_NO_NODE_JS&&!r&&"object"==typeof process&&process.versions&&process.versions.node;h?e=global:i&&(e=self);var s=!e.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,n="function"==typeof define&&define.amd,a="0123456789abcdef".split(""),o=[128,32768,8388608,-2147483648],f=["hex","array","digest","arrayBuffer"];f.push("buffer"),f.push("base64");var u,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),p=[],c=new ArrayBuffer(68);u=new Uint8Array(c),p=new Uint32Array(c);var d=Array.isArray,l=ArrayBuffer.isView,b=function(r){var e=typeof r;if("string"===e)return[r,!0];if("object"!==e||null===r)throw new Error(t);if(r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(d(r))return[r,!1];if(!l(r))throw new Error(t);return[new Uint8Array(r.buffer,r.byteOffset,r.byteLength),!1]},v=function(t){return function(r){return new g(!0).update(r)[t]()}},w=function(r){var e=require("crypto"),i=require("buffer").Buffer,h=i.from;return function(s){if("string"==typeof s)return e.createHash("md5").update(s,"utf8").digest("hex");if(null==s)throw new Error(t);return s.constructor===ArrayBuffer?s=new Uint8Array(s):l(s)&&s.constructor!==i&&(s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),d(s)||l(s)||s.constructor===i?e.createHash("md5").update(h(s)).digest("hex"):r(s)}},A=function(t){return function(r,e){return new B(r,!0).update(e)[t]()}};function g(t){if(t)p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p,this.buffer8=u;else{var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function B(t,r){var e,i=b(t);if(t=i[0],i[1]){var h,s,n=[],a=t.length,o=0;for(e=0;e<a;++e)(h=t.charCodeAt(e))<128?n[o++]=h:h<2048?(n[o++]=192|h>>>6,n[o++]=128|63&h):h<55296||h>=57344?(n[o++]=224|h>>>12,n[o++]=128|h>>>6&63,n[o++]=128|63&h):h<56320&&(s=t.charCodeAt(e+1))>=56320&&s<57344?(++e,h=65536+((1023&h)<<10|1023&s),n[o++]=240|h>>>18,n[o++]=128|h>>>12&63,n[o++]=128|h>>>6&63,n[o++]=128|63&h):(n[o++]=239,n[o++]=191,n[o++]=189);t=n}t.length>64&&(t=new g(!0).update(t).array());var f=[],u=[];for(e=0;e<64;++e){var y=t[e]||0;f[e]=92^y,u[e]=54^y}g.call(this,r),this.update(u),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r=b(t);t=r[0];for(var e,i,h,s=r[1],n=0,a=t.length,o=this.blocks,f=this.buffer8;n<a;){if(this.hashed&&(this.hashed=!1,o[0]=o[16],o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),s)for(h=this.start;n<a&&h<64;++n)(e=t.charCodeAt(n))<128?f[h++]=e:e<2048?(f[h++]=192|e>>>6,f[h++]=128|63&e):e<55296||e>=57344?(f[h++]=224|e>>>12,f[h++]=128|e>>>6&63,f[h++]=128|63&e):e<56320&&(i=t.charCodeAt(n+1))>=56320&&i<57344?(++n,e=65536+((1023&e)<<10|1023&i),f[h++]=240|e>>>18,f[h++]=128|e>>>12&63,f[h++]=128|e>>>6&63,f[h++]=128|63&e):(f[h++]=239,f[h++]=191,f[h++]=189);else for(h=this.start;n<a&&h<64;++n)f[h++]=t[n];this.lastByteIndex=h,this.bytes+=h-this.start,h>=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>>2]|=o[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},g.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?r=((r=((t=((t=n[0]-680876937)<<7|t>>>25)-271733879|0)^(e=((e=(-271733879^(i=((i=(-1732584194^2004318071&t)+n[1]-117830708)<<12|i>>>20)+t|0)&(-271733879^t))+n[2]-1126478375)<<17|e>>>15)+i|0)&(i^t))+n[3]-1316259209)<<22|r>>>10)+e|0:(t=this.h0,r=this.h1,e=this.h2,r=((r+=((t=((t+=((i=this.h3)^r&(e^i))+n[0]-680876936)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[1]-389564586)<<12|i>>>20)+t|0)&(t^r))+n[2]+606105819)<<17|e>>>15)+i|0)&(i^t))+n[3]-1044525330)<<22|r>>>10)+e|0),r=((r+=((t=((t+=(i^r&(e^i))+n[4]-176418897)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[5]+1200080426)<<12|i>>>20)+t|0)&(t^r))+n[6]-1473231341)<<17|e>>>15)+i|0)&(i^t))+n[7]-45705983)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[8]+1770035416)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[9]-1958414417)<<12|i>>>20)+t|0)&(t^r))+n[10]-42063)<<17|e>>>15)+i|0)&(i^t))+n[11]-1990404162)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[12]+1804603682)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[13]-40341101)<<12|i>>>20)+t|0)&(t^r))+n[14]-1502002290)<<17|e>>>15)+i|0)&(i^t))+n[15]+1236535329)<<22|r>>>10)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[1]-165796510)<<5|t>>>27)+r|0)^r))+n[6]-1069501632)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[11]+643717713)<<14|e>>>18)+i|0)^i))+n[0]-373897302)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[5]-701558691)<<5|t>>>27)+r|0)^r))+n[10]+38016083)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[15]-660478335)<<14|e>>>18)+i|0)^i))+n[4]-405537848)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[9]+568446438)<<5|t>>>27)+r|0)^r))+n[14]-1019803690)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[3]-187363961)<<14|e>>>18)+i|0)^i))+n[8]+1163531501)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[13]-1444681467)<<5|t>>>27)+r|0)^r))+n[2]-51403784)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[7]+1735328473)<<14|e>>>18)+i|0)^i))+n[12]-1926607734)<<20|r>>>12)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[5]-378558)<<4|t>>>28)+r|0))+n[8]-2022574463)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[11]+1839030562)<<16|e>>>16)+i|0))+n[14]-35309556)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[1]-1530992060)<<4|t>>>28)+r|0))+n[4]+1272893353)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[7]-155497632)<<16|e>>>16)+i|0))+n[10]-1094730640)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[13]+681279174)<<4|t>>>28)+r|0))+n[0]-358537222)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[3]-722521979)<<16|e>>>16)+i|0))+n[6]+76029189)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[9]-640364487)<<4|t>>>28)+r|0))+n[12]-421815835)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[15]+530742520)<<16|e>>>16)+i|0))+n[2]-995338651)<<23|r>>>9)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[0]-198630844)<<6|t>>>26)+r|0)|~e))+n[7]+1126891415)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[14]-1416354905)<<15|e>>>17)+i|0)|~t))+n[5]-57434055)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[12]+1700485571)<<6|t>>>26)+r|0)|~e))+n[3]-1894986606)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[10]-1051523)<<15|e>>>17)+i|0)|~t))+n[1]-2054922799)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[8]+1873313359)<<6|t>>>26)+r|0)|~e))+n[15]-30611744)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[6]-1560198380)<<15|e>>>17)+i|0)|~t))+n[13]+1309151649)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[4]-145523070)<<6|t>>>26)+r|0)|~e))+n[11]-1120210379)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[2]+718787259)<<15|e>>>17)+i|0)|~t))+n[9]-343485551)<<21|r>>>11)+e|0,this.first?(this.h0=t+1732584193|0,this.h1=r-271733879|0,this.h2=e-1732584194|0,this.h3=i+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+r|0,this.h2=this.h2+e|0,this.h3=this.h3+i|0)},g.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return a[t>>>4&15]+a[15&t]+a[t>>>12&15]+a[t>>>8&15]+a[t>>>20&15]+a[t>>>16&15]+a[t>>>28&15]+a[t>>>24&15]+a[r>>>4&15]+a[15&r]+a[r>>>12&15]+a[r>>>8&15]+a[r>>>20&15]+a[r>>>16&15]+a[r>>>28&15]+a[r>>>24&15]+a[e>>>4&15]+a[15&e]+a[e>>>12&15]+a[e>>>8&15]+a[e>>>20&15]+a[e>>>16&15]+a[e>>>28&15]+a[e>>>24&15]+a[i>>>4&15]+a[15&i]+a[i>>>12&15]+a[i>>>8&15]+a[i>>>20&15]+a[i>>>16&15]+a[i>>>28&15]+a[i>>>24&15]},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&i,i>>>8&255,i>>>16&255,i>>>24&255]},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},g.prototype.buffer=g.prototype.arrayBuffer,g.prototype.base64=function(){for(var t,r,e,i="",h=this.array(),s=0;s<15;)t=h[s++],r=h[s++],e=h[s++],i+=y[t>>>2]+y[63&(t<<4|r>>>4)]+y[63&(r<<2|e>>>6)]+y[63&e];return t=h[s],i+=y[t>>>2]+y[t<<4&63]+"=="},B.prototype=new g,B.prototype.finalize=function(){if(g.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();g.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(t),g.prototype.finalize.call(this)}};var m=function(){var t=v("hex");h&&(t=w(t)),t.create=function(){return new g},t.update=function(r){return t.create().update(r)};for(var r=0;r<f.length;++r){var e=f[r];t[e]=v(e)}return t}();m.md5=m,m.md5.hmac=function(){var t=A("hex");t.create=function(t){return new B(t)},t.update=function(r,e){return t.create(r).update(e)};for(var r=0;r<f.length;++r){var e=f[r];t[e]=A(e)}return t}(),s?module.exports=m:(e.md5=m,n&&define(function(){return m}))}();
|
package/build/md5.modern.min.mjs
CHANGED
|
@@ -3,8 +3,8 @@ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"de
|
|
|
3
3
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
4
4
|
*
|
|
5
5
|
* @namespace md5
|
|
6
|
-
* @version 0.
|
|
6
|
+
* @version 0.11.0
|
|
7
7
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
8
8
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/r=e,function(){var t="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(i=self);var h=!i.JS_MD5_NO_COMMON_JS&&r.exports,s="0123456789abcdef".split(""),
|
|
10
|
+
*/r=e,function(){var t="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(i=self);var h=!i.JS_MD5_NO_COMMON_JS&&r.exports,s="0123456789abcdef".split(""),n=[128,32768,8388608,-2147483648],a=["hex","array","digest","arrayBuffer"];a.push("buffer"),a.push("base64");var o,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),u=[],y=new ArrayBuffer(68);o=new Uint8Array(y),u=new Uint32Array(y);var p=Array.isArray,l=ArrayBuffer.isView,c=function(r){var e=typeof r;if("string"===e)return[r,!0];if("object"!==e||null===r)throw new Error(t);if(r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(p(r))return[r,!1];if(!l(r))throw new Error(t);return[new Uint8Array(r.buffer,r.byteOffset,r.byteLength),!1]},d=function(t){return function(r){return new v(!0).update(r)[t]()}},b=function(t){return function(r,e){return new w(r,!0).update(e)[t]()}};function v(t){if(t)u[0]=u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0,this.blocks=u,this.buffer8=o;else{var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function w(t,r){var e,i=c(t);if(t=i[0],i[1]){var h,s,n=[],a=t.length,o=0;for(e=0;e<a;++e)(h=t.charCodeAt(e))<128?n[o++]=h:h<2048?(n[o++]=192|h>>>6,n[o++]=128|63&h):h<55296||h>=57344?(n[o++]=224|h>>>12,n[o++]=128|h>>>6&63,n[o++]=128|63&h):h<56320&&(s=t.charCodeAt(e+1))>=56320&&s<57344?(++e,h=65536+((1023&h)<<10|1023&s),n[o++]=240|h>>>18,n[o++]=128|h>>>12&63,n[o++]=128|h>>>6&63,n[o++]=128|63&h):(n[o++]=239,n[o++]=191,n[o++]=189);t=n}t.length>64&&(t=new v(!0).update(t).array());var f=[],u=[];for(e=0;e<64;++e){var y=t[e]||0;f[e]=92^y,u[e]=54^y}v.call(this,r),this.update(u),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}v.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r=c(t);t=r[0];for(var e,i,h,s=r[1],n=0,a=t.length,o=this.blocks,f=this.buffer8;n<a;){if(this.hashed&&(this.hashed=!1,o[0]=o[16],o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),s)for(h=this.start;n<a&&h<64;++n)(e=t.charCodeAt(n))<128?f[h++]=e:e<2048?(f[h++]=192|e>>>6,f[h++]=128|63&e):e<55296||e>=57344?(f[h++]=224|e>>>12,f[h++]=128|e>>>6&63,f[h++]=128|63&e):e<56320&&(i=t.charCodeAt(n+1))>=56320&&i<57344?(++n,e=65536+((1023&e)<<10|1023&i),f[h++]=240|e>>>18,f[h++]=128|e>>>12&63,f[h++]=128|e>>>6&63,f[h++]=128|63&e):(f[h++]=239,f[h++]=191,f[h++]=189);else for(h=this.start;n<a&&h<64;++n)f[h++]=t[n];this.lastByteIndex=h,this.bytes+=h-this.start,h>=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this},v.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>>2]|=n[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},v.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?r=((r=((t=((t=n[0]-680876937)<<7|t>>>25)-271733879|0)^(e=((e=(-271733879^(i=((i=(-1732584194^2004318071&t)+n[1]-117830708)<<12|i>>>20)+t|0)&(-271733879^t))+n[2]-1126478375)<<17|e>>>15)+i|0)&(i^t))+n[3]-1316259209)<<22|r>>>10)+e|0:(t=this.h0,r=this.h1,e=this.h2,r=((r+=((t=((t+=((i=this.h3)^r&(e^i))+n[0]-680876936)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[1]-389564586)<<12|i>>>20)+t|0)&(t^r))+n[2]+606105819)<<17|e>>>15)+i|0)&(i^t))+n[3]-1044525330)<<22|r>>>10)+e|0),r=((r+=((t=((t+=(i^r&(e^i))+n[4]-176418897)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[5]+1200080426)<<12|i>>>20)+t|0)&(t^r))+n[6]-1473231341)<<17|e>>>15)+i|0)&(i^t))+n[7]-45705983)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[8]+1770035416)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[9]-1958414417)<<12|i>>>20)+t|0)&(t^r))+n[10]-42063)<<17|e>>>15)+i|0)&(i^t))+n[11]-1990404162)<<22|r>>>10)+e|0,r=((r+=((t=((t+=(i^r&(e^i))+n[12]+1804603682)<<7|t>>>25)+r|0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+n[13]-40341101)<<12|i>>>20)+t|0)&(t^r))+n[14]-1502002290)<<17|e>>>15)+i|0)&(i^t))+n[15]+1236535329)<<22|r>>>10)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[1]-165796510)<<5|t>>>27)+r|0)^r))+n[6]-1069501632)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[11]+643717713)<<14|e>>>18)+i|0)^i))+n[0]-373897302)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[5]-701558691)<<5|t>>>27)+r|0)^r))+n[10]+38016083)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[15]-660478335)<<14|e>>>18)+i|0)^i))+n[4]-405537848)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[9]+568446438)<<5|t>>>27)+r|0)^r))+n[14]-1019803690)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[3]-187363961)<<14|e>>>18)+i|0)^i))+n[8]+1163531501)<<20|r>>>12)+e|0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+n[13]-1444681467)<<5|t>>>27)+r|0)^r))+n[2]-51403784)<<9|i>>>23)+t|0)^t&((e=((e+=(t^r&(i^t))+n[7]+1735328473)<<14|e>>>18)+i|0)^i))+n[12]-1926607734)<<20|r>>>12)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[5]-378558)<<4|t>>>28)+r|0))+n[8]-2022574463)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[11]+1839030562)<<16|e>>>16)+i|0))+n[14]-35309556)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[1]-1530992060)<<4|t>>>28)+r|0))+n[4]+1272893353)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[7]-155497632)<<16|e>>>16)+i|0))+n[10]-1094730640)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[13]+681279174)<<4|t>>>28)+r|0))+n[0]-358537222)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[3]-722521979)<<16|e>>>16)+i|0))+n[6]+76029189)<<23|r>>>9)+e|0,r=((r+=((s=(i=((i+=((h=r^e)^(t=((t+=(h^i)+n[9]-640364487)<<4|t>>>28)+r|0))+n[12]-421815835)<<11|i>>>21)+t|0)^t)^(e=((e+=(s^r)+n[15]+530742520)<<16|e>>>16)+i|0))+n[2]-995338651)<<23|r>>>9)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[0]-198630844)<<6|t>>>26)+r|0)|~e))+n[7]+1126891415)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[14]-1416354905)<<15|e>>>17)+i|0)|~t))+n[5]-57434055)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[12]+1700485571)<<6|t>>>26)+r|0)|~e))+n[3]-1894986606)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[10]-1051523)<<15|e>>>17)+i|0)|~t))+n[1]-2054922799)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[8]+1873313359)<<6|t>>>26)+r|0)|~e))+n[15]-30611744)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[6]-1560198380)<<15|e>>>17)+i|0)|~t))+n[13]+1309151649)<<21|r>>>11)+e|0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+n[4]-145523070)<<6|t>>>26)+r|0)|~e))+n[11]-1120210379)<<10|i>>>22)+t|0)^((e=((e+=(t^(i|~r))+n[2]+718787259)<<15|e>>>17)+i|0)|~t))+n[9]-343485551)<<21|r>>>11)+e|0,this.first?(this.h0=t+1732584193|0,this.h1=r-271733879|0,this.h2=e-1732584194|0,this.h3=i+271733878|0,this.first=!1):(this.h0=this.h0+t|0,this.h1=this.h1+r|0,this.h2=this.h2+e|0,this.h3=this.h3+i|0)},v.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return s[t>>>4&15]+s[15&t]+s[t>>>12&15]+s[t>>>8&15]+s[t>>>20&15]+s[t>>>16&15]+s[t>>>28&15]+s[t>>>24&15]+s[r>>>4&15]+s[15&r]+s[r>>>12&15]+s[r>>>8&15]+s[r>>>20&15]+s[r>>>16&15]+s[r>>>28&15]+s[r>>>24&15]+s[e>>>4&15]+s[15&e]+s[e>>>12&15]+s[e>>>8&15]+s[e>>>20&15]+s[e>>>16&15]+s[e>>>28&15]+s[e>>>24&15]+s[i>>>4&15]+s[15&i]+s[i>>>12&15]+s[i>>>8&15]+s[i>>>20&15]+s[i>>>16&15]+s[i>>>28&15]+s[i>>>24&15]},v.prototype.toString=v.prototype.hex,v.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&r,r>>>8&255,r>>>16&255,r>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255,255&i,i>>>8&255,i>>>16&255,i>>>24&255]},v.prototype.array=v.prototype.digest,v.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},v.prototype.buffer=v.prototype.arrayBuffer,v.prototype.base64=function(){for(var t,r,e,i="",h=this.array(),s=0;s<15;)t=h[s++],r=h[s++],e=h[s++],i+=f[t>>>2]+f[63&(t<<4|r>>>4)]+f[63&(r<<2|e>>>6)]+f[63&e];return t=h[s],i+=f[t>>>2]+f[t<<4&63]+"=="},w.prototype=new v,w.prototype.finalize=function(){if(v.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();v.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(t),v.prototype.finalize.call(this)}};var A=function(){var t=d("hex");t.create=function(){return new v},t.update=function(r){return t.create().update(r)};for(var r=0;r<a.length;++r){var e=a[r];t[e]=d(e)}return t}();A.md5=A,A.md5.hmac=function(){var t=b("hex");t.create=function(t){return new w(t)},t.update=function(r,e){return t.create(r).update(e)};for(var r=0;r<a.length;++r){var e=a[r];t[e]=b(e)}return t}(),h?r.exports=A:i.md5=A}();var i=t(e.exports);export{i as default,i as md5};
|
package/build/md5.modern.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var md5$1 = {exports: {}};
|
|
|
8
8
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
9
9
|
*
|
|
10
10
|
* @namespace md5
|
|
11
|
-
* @version 0.
|
|
11
|
+
* @version 0.11.0
|
|
12
12
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
13
13
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
14
14
|
* @license MIT
|
|
@@ -52,7 +52,7 @@ var md5$1 = {exports: {}};
|
|
|
52
52
|
|
|
53
53
|
var isArray = Array.isArray;
|
|
54
54
|
|
|
55
|
-
var isView = ArrayBuffer.isView;
|
|
55
|
+
var isView = ArrayBuffer.isView ;
|
|
56
56
|
|
|
57
57
|
// [message: string, isString: bool]
|
|
58
58
|
var formatMessage = function (message) {
|
|
@@ -66,10 +66,14 @@ var md5$1 = {exports: {}};
|
|
|
66
66
|
if (message.constructor === ArrayBuffer) {
|
|
67
67
|
return [new Uint8Array(message), false];
|
|
68
68
|
}
|
|
69
|
-
if (
|
|
69
|
+
if (isArray(message)) {
|
|
70
|
+
return [message, false];
|
|
71
|
+
}
|
|
72
|
+
if (!isView(message)) {
|
|
70
73
|
throw new Error(INPUT_ERROR);
|
|
71
74
|
}
|
|
72
|
-
|
|
75
|
+
// read the underlying bytes of any view (DataView, Uint16Array, ...)
|
|
76
|
+
return [new Uint8Array(message.buffer, message.byteOffset, message.byteLength), false];
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
/**
|
|
@@ -323,7 +327,7 @@ var md5$1 = {exports: {}};
|
|
|
323
327
|
var result = formatMessage(message);
|
|
324
328
|
message = result[0];
|
|
325
329
|
var isString = result[1];
|
|
326
|
-
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
|
330
|
+
var code, code2, index = 0, i, length = message.length, blocks = this.blocks;
|
|
327
331
|
var buffer8 = this.buffer8;
|
|
328
332
|
|
|
329
333
|
while (index < length) {
|
|
@@ -349,12 +353,18 @@ var md5$1 = {exports: {}};
|
|
|
349
353
|
buffer8[i++] = 0xe0 | (code >>> 12);
|
|
350
354
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
351
355
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
352
|
-
} else {
|
|
353
|
-
|
|
356
|
+
} else if (code < 0xdc00 && (code2 = message.charCodeAt(index + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
357
|
+
++index;
|
|
358
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
354
359
|
buffer8[i++] = 0xf0 | (code >>> 18);
|
|
355
360
|
buffer8[i++] = 0x80 | ((code >>> 12) & 0x3f);
|
|
356
361
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
357
362
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
363
|
+
} else {
|
|
364
|
+
// unpaired surrogate: U+FFFD
|
|
365
|
+
buffer8[i++] = 0xef;
|
|
366
|
+
buffer8[i++] = 0xbf;
|
|
367
|
+
buffer8[i++] = 0xbd;
|
|
358
368
|
}
|
|
359
369
|
}
|
|
360
370
|
}
|
|
@@ -733,7 +743,7 @@ var md5$1 = {exports: {}};
|
|
|
733
743
|
var i, result = formatMessage(key);
|
|
734
744
|
key = result[0];
|
|
735
745
|
if (result[1]) {
|
|
736
|
-
var bytes = [], length = key.length, index = 0, code;
|
|
746
|
+
var bytes = [], length = key.length, index = 0, code, code2;
|
|
737
747
|
for (i = 0; i < length; ++i) {
|
|
738
748
|
code = key.charCodeAt(i);
|
|
739
749
|
if (code < 0x80) {
|
|
@@ -745,12 +755,18 @@ var md5$1 = {exports: {}};
|
|
|
745
755
|
bytes[index++] = (0xe0 | (code >>> 12));
|
|
746
756
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
747
757
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
748
|
-
} else {
|
|
749
|
-
|
|
758
|
+
} else if (code < 0xdc00 && (code2 = key.charCodeAt(i + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
759
|
+
++i;
|
|
760
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
750
761
|
bytes[index++] = (0xf0 | (code >>> 18));
|
|
751
762
|
bytes[index++] = (0x80 | ((code >>> 12) & 0x3f));
|
|
752
763
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
753
764
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
765
|
+
} else {
|
|
766
|
+
// unpaired surrogate: U+FFFD
|
|
767
|
+
bytes[index++] = 0xef;
|
|
768
|
+
bytes[index++] = 0xbf;
|
|
769
|
+
bytes[index++] = 0xbd;
|
|
754
770
|
}
|
|
755
771
|
}
|
|
756
772
|
key = bytes;
|
|
@@ -13,7 +13,7 @@ var md5$1 = {exports: {}};
|
|
|
13
13
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
14
14
|
*
|
|
15
15
|
* @namespace md5
|
|
16
|
-
* @version 0.
|
|
16
|
+
* @version 0.11.0
|
|
17
17
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
18
18
|
* @copyright Chen, Yi-Cyuan 2014-2026
|
|
19
19
|
* @license MIT
|
|
@@ -61,7 +61,7 @@ var md5$1 = {exports: {}};
|
|
|
61
61
|
|
|
62
62
|
var isArray = Array.isArray;
|
|
63
63
|
|
|
64
|
-
var isView = ArrayBuffer.isView;
|
|
64
|
+
var isView = ArrayBuffer.isView ;
|
|
65
65
|
|
|
66
66
|
// [message: string, isString: bool]
|
|
67
67
|
var formatMessage = function (message) {
|
|
@@ -75,10 +75,14 @@ var md5$1 = {exports: {}};
|
|
|
75
75
|
if (message.constructor === ArrayBuffer) {
|
|
76
76
|
return [new Uint8Array(message), false];
|
|
77
77
|
}
|
|
78
|
-
if (
|
|
78
|
+
if (isArray(message)) {
|
|
79
|
+
return [message, false];
|
|
80
|
+
}
|
|
81
|
+
if (!isView(message)) {
|
|
79
82
|
throw new Error(INPUT_ERROR);
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
// read the underlying bytes of any view (DataView, Uint16Array, ...)
|
|
85
|
+
return [new Uint8Array(message.buffer, message.byteOffset, message.byteLength), false];
|
|
82
86
|
};
|
|
83
87
|
|
|
84
88
|
/**
|
|
@@ -194,6 +198,8 @@ var md5$1 = {exports: {}};
|
|
|
194
198
|
throw new Error(INPUT_ERROR);
|
|
195
199
|
} else if (message.constructor === ArrayBuffer) {
|
|
196
200
|
message = new Uint8Array(message);
|
|
201
|
+
} else if (isView(message) && message.constructor !== Buffer) {
|
|
202
|
+
message = new Uint8Array(message.buffer, message.byteOffset, message.byteLength);
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
205
|
if (isArray(message) || isView(message) ||
|
|
@@ -359,7 +365,7 @@ var md5$1 = {exports: {}};
|
|
|
359
365
|
var result = formatMessage(message);
|
|
360
366
|
message = result[0];
|
|
361
367
|
var isString = result[1];
|
|
362
|
-
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
|
368
|
+
var code, code2, index = 0, i, length = message.length, blocks = this.blocks;
|
|
363
369
|
var buffer8 = this.buffer8;
|
|
364
370
|
|
|
365
371
|
while (index < length) {
|
|
@@ -385,12 +391,18 @@ var md5$1 = {exports: {}};
|
|
|
385
391
|
buffer8[i++] = 0xe0 | (code >>> 12);
|
|
386
392
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
387
393
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
388
|
-
} else {
|
|
389
|
-
|
|
394
|
+
} else if (code < 0xdc00 && (code2 = message.charCodeAt(index + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
395
|
+
++index;
|
|
396
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
390
397
|
buffer8[i++] = 0xf0 | (code >>> 18);
|
|
391
398
|
buffer8[i++] = 0x80 | ((code >>> 12) & 0x3f);
|
|
392
399
|
buffer8[i++] = 0x80 | ((code >>> 6) & 0x3f);
|
|
393
400
|
buffer8[i++] = 0x80 | (code & 0x3f);
|
|
401
|
+
} else {
|
|
402
|
+
// unpaired surrogate: U+FFFD
|
|
403
|
+
buffer8[i++] = 0xef;
|
|
404
|
+
buffer8[i++] = 0xbf;
|
|
405
|
+
buffer8[i++] = 0xbd;
|
|
394
406
|
}
|
|
395
407
|
}
|
|
396
408
|
}
|
|
@@ -769,7 +781,7 @@ var md5$1 = {exports: {}};
|
|
|
769
781
|
var i, result = formatMessage(key);
|
|
770
782
|
key = result[0];
|
|
771
783
|
if (result[1]) {
|
|
772
|
-
var bytes = [], length = key.length, index = 0, code;
|
|
784
|
+
var bytes = [], length = key.length, index = 0, code, code2;
|
|
773
785
|
for (i = 0; i < length; ++i) {
|
|
774
786
|
code = key.charCodeAt(i);
|
|
775
787
|
if (code < 0x80) {
|
|
@@ -781,12 +793,18 @@ var md5$1 = {exports: {}};
|
|
|
781
793
|
bytes[index++] = (0xe0 | (code >>> 12));
|
|
782
794
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
783
795
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
784
|
-
} else {
|
|
785
|
-
|
|
796
|
+
} else if (code < 0xdc00 && (code2 = key.charCodeAt(i + 1)) >= 0xdc00 && code2 < 0xe000) {
|
|
797
|
+
++i;
|
|
798
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
|
|
786
799
|
bytes[index++] = (0xf0 | (code >>> 18));
|
|
787
800
|
bytes[index++] = (0x80 | ((code >>> 12) & 0x3f));
|
|
788
801
|
bytes[index++] = (0x80 | ((code >>> 6) & 0x3f));
|
|
789
802
|
bytes[index++] = (0x80 | (code & 0x3f));
|
|
803
|
+
} else {
|
|
804
|
+
// unpaired surrogate: U+FFFD
|
|
805
|
+
bytes[index++] = 0xef;
|
|
806
|
+
bytes[index++] = 0xbf;
|
|
807
|
+
bytes[index++] = 0xbd;
|
|
790
808
|
}
|
|
791
809
|
}
|
|
792
810
|
key = bytes;
|