mirror of https://github.com/emn178/js-md5.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
8.0 KiB
JavaScript
10 lines
8.0 KiB
JavaScript
![]()
2 years ago
|
/**
|
||
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||
|
*
|
||
|
* @namespace md5
|
||
|
* @version 0.8.3
|
||
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
|
* @copyright Chen, Yi-Cyuan 2014-2023
|
||
|
* @license MIT
|
||
|
*/
|
||
|
!function(){"use strict";var r,a="input is invalid type",t="object"==typeof window?window:{},e="undefined"!=typeof WorkerGlobalScope&&!!WorkerGlobalScope,i="object"==typeof process&&process.versions&&process.versions.node,e=(i?t=global:e&&(t=self),"object"==typeof module&&module.exports),s="function"==typeof define&&define.amd,u=ArrayBuffer,h="0123456789abcdef".split(""),n=[128,32768,8388608,-2147483648],o=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),y=Array.isArray,c=u.isView,p=[];function d(t){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=r):(t=new u(68),this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)),this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}function l(r){return function(t){return new d(!0).update(t)[r]()}}A=new u(68),r=new Uint8Array(A),p=new Uint32Array(A),d.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");for(var r,e,i=function(t){var r=typeof t;if("string"==r)return[t,!0];if("object"==r&&null!==t){if(t.constructor===u)return[new Uint8Array(t),!1];if(y(t)||c(t))return[t,!1]}throw new Error(a)}(t),s=(t=i[0],i[1]),h=0,n=t.length,o=this.blocks,f=this.buffer8;h<n;){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(e=this.start;h<n&&e<64;++h)(r=t.charCodeAt(h))<128?f[e++]=r:(r<2048?f[e++]=192|r>>>6:(r<55296||57344<=r?f[e++]=224|r>>>12:(r=65536+((1023&r)<<10|1023&t.charCodeAt(++h)),f[e++]=240|r>>>18,f[e++]=128|r>>>12&63),f[e++]=128|r>>>6&63),f[e++]=128|63&r);else for(e=this.start;h<n&&e<64;++h)f[e++]=t[h];this.lastByteIndex=e,this.bytes+=e-this.start,64<=e?(this.start=e-64,this.hash(),this.hashed=!0):this.start=e}return 4294967295<this.bytes&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},d.prototype.finalize=function(){var t,r;this.finalized||(this.finalized=!0,(t=this.blocks)[(r=this.lastByteIndex)>>>2]|=n[3&r],56<=r&&(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())},d.prototype.hash=function(){var t,r,e,i,s,h=this.blocks,n=this.first?((n=((t=((t=h[0]-680876937)<<7|t>>>25)-271733879<<0)^(r=((r=(-271733879^(e=((e=(-1732584194^2004318071&t)+h[1]-117830708)<<12|e>>>20)+t<<0)&(-271733879^t))+h[2]-1126478375)<<17|r>>>15)+e<<0)&(e^t))+h[3]-1316259209)<<22|n>>>10)+r<<0:(t=this.h0,n=this.h1,r=this.h2,((n+=((t=((t+=((e=this.h3)^n&(r^e))+h[0]-680876936)<<7|t>>>25)+n<<0)^(r=((r+=(n^(e=((e+=(r^t&(n^r))+h[1]-389564586)<<12|e>>>20)+t<<0)&(t^n))+h[2]+606105819)<<17|r>>>15)+e<<0)&(e^t))+h[3]-1044525330)<<22|n>>>10)+r<<0),n=((n+=((t=((t+=(e^n&(r^e))+h[4]-176418897)<<7|t>>>25)+n<<0)^(r=((r+=(n^(e=((e+=(r^t&(n^r))+h[5]+1200080426)<<12|e>>>20)+t<<0)&(t^n))+h[6]-1473231341)<<17|r>>>15)+e<<0)&(e^t))+h[7]-45705983)<<22|n>>>10)+r<<0;n=((n+=((t=((t+=(e^n&(r^e))+h[8]+1770035416)<<7|t>>>25)+n<<0)^(r=((r+=(n^(e=((e+=(r^t&(n^r))+h[9]-1958414417)<<12|e>>>20)+t<<0)&(t^n))+h[10]-42063)<<17|r>>>15)+e<<0)&(e^t))+h[11]-1990404162)<<22|n>>>10)+r<<0,n=((n+=((t=((t+=(e^n&(r^e))+h[12]+1804603682)<<7|t>>>25)+n<<0)^(r=((r+=(n^(e=((e+=(r^t&(n^r))+h[13]-40341101)<<12|e>>>20)+t<<0)&(t^n))+h[14]-1502002290)<<17|r>>>15)+e<<0)&(e^t))+h[15]+1236535329)<<22|n>>>10)+r<<0,n=((n+=((e=((e+=(n^r&((t=((t+=(r^e&(n^r))+h[1]-165796510)<<5|t>>>27)+n<<0)^n))+h[6]-1069501632)<<9|e>>>23)+t<<0)^t&((r=((r+=(t^n&(e^t))+h[11]+643717713)<<14|r>>>18)+e<<0)^e))+h[0]-373897302)<<20|n>>>12)+r<<0,n=((n+=((e=((e+=(n^r&((t=((t+=(r^e&(n^r))+h[5]-701558691)<<5|t>>>27)+n<<0)^n))+h[10]+38016083)<<9|e>>>23)+t<<0)^t&((r=((r+=(t^n&(e^t))+h[15]-660478335)<<14|r>>>18)+e<<0)^e))+h[4]-405537848)<<20|n>>>12)+r<<0,n=((n+=((e=((e+=(n^r&((t=((t+=(r^e&(n^r))+h[9]+568446438)<<5|t>>>27)+n<<0)^n))+h[14]-1019803690)<<9|e>>>23)+t<<0)^t&((r=((r+=(t^n&(e^t))+h
|