Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-md5

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-md5 - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

a.js

3

bower.json
{
"name": "js-md5",
"version": "0.4.0",
"version": "0.4.1",
"main": ["src/md5.js"],
"ignore": [
"samples",
"tests"
]
}

@@ -6,6 +6,6 @@ /**

* @version 0.4.0
* @author Yi-Cyuan Chen [emn178@gmail.com]
* @copyright Yi-Cyuan Chen 2014-2015
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2016
* @license MIT
*/
!function(t){"use strict";function e(t){if(t)c[0]=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0,this.blocks=c,this.buffer8=r;else if(n){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}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=0,this.finalized=this.hashed=!1,this.first=!0}var h="object"==typeof process&&process.versions&&process.versions.node;h&&(t=global);var r,i=!t.JS_MD5_TEST&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,n=!t.JS_MD5_TEST&&"undefined"!=typeof ArrayBuffer,o="0123456789abcdef".split(""),f=[128,32768,8388608,-2147483648],a=[0,8,16,24],u=["hex","array","digest","buffer"],c=[];if(n){var d=new ArrayBuffer(68);r=new Uint8Array(d),c=new Uint32Array(d)}var l=function(t){return function(h){return new e(!0).update(h)[t]()}},y=function(){var t=l("hex");h&&(t=p(t)),t.create=function(){return new e},t.update=function(e){return t.create().update(e)};for(var r=0;r<u.length;++r){var i=u[r];t[i]=l(i)}return t},p=function(e){var h,r;try{if(t.JS_MD5_TEST)throw"JS_MD5_TEST";h=require("crypto"),r=require("buffer").Buffer}catch(i){return console.log(i),e}var s=function(t){if("string"==typeof t)return t.length<=s.utf8Threshold?e(t):t.length<=s.asciiThreshold&&!/[^\x00-\x7F]/.test(t)?e(t):h.createHash("md5").update(t,"utf8").digest("hex");if(t.constructor==ArrayBuffer)t=new Uint8Array(t);else if(void 0===t.length||t.length<=s.bytesThreshold)return e(t);return h.createHash("md5").update(new r(t)).digest("hex")};return s.utf8Threshold=18,s.asciiThreshold=60,s.bytesThreshold=245,s};e.prototype.update=function(e){if(!this.finalized){var h="string"!=typeof e;h&&e.constructor==t.ArrayBuffer&&(e=new Uint8Array(e));for(var r,i,s=0,o=e.length||0,f=this.blocks,u=this.buffer8;o>s;){if(this.hashed&&(this.hashed=!1,f[0]=f[16],f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0),h)if(n)for(i=this.start;o>s&&64>i;++s)u[i++]=e[s];else for(i=this.start;o>s&&64>i;++s)f[i>>2]|=e[s]<<a[3&i++];else if(n)for(i=this.start;o>s&&64>i;++s)r=e.charCodeAt(s),128>r?u[i++]=r:2048>r?(u[i++]=192|r>>6,u[i++]=128|63&r):55296>r||r>=57344?(u[i++]=224|r>>12,u[i++]=128|r>>6&63,u[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),u[i++]=240|r>>18,u[i++]=128|r>>12&63,u[i++]=128|r>>6&63,u[i++]=128|63&r);else for(i=this.start;o>s&&64>i;++s)r=e.charCodeAt(s),128>r?f[i>>2]|=r<<a[3&i++]:2048>r?(f[i>>2]|=(192|r>>6)<<a[3&i++],f[i>>2]|=(128|63&r)<<a[3&i++]):55296>r||r>=57344?(f[i>>2]|=(224|r>>12)<<a[3&i++],f[i>>2]|=(128|r>>6&63)<<a[3&i++],f[i>>2]|=(128|63&r)<<a[3&i++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),f[i>>2]|=(240|r>>18)<<a[3&i++],f[i>>2]|=(128|r>>12&63)<<a[3&i++],f[i>>2]|=(128|r>>6&63)<<a[3&i++],f[i>>2]|=(128|63&r)<<a[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this}},e.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=f[3&e],e>=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,this.hash()}},e.prototype.hash=function(){var t,e,h,r,i,s,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,r=(-1732584194^2004318071&t)+n[1]-117830708,r=(r<<12|r>>>20)+t<<0,h=(-271733879^r&(-271733879^t))+n[2]-1126478375,h=(h<<17|h>>>15)+r<<0,e=(t^h&(r^t))+n[3]-1316259209,e=(e<<22|e>>>10)+h<<0):(t=this.h0,e=this.h1,h=this.h2,r=this.h3,t+=(r^e&(h^r))+n[0]-680876936,t=(t<<7|t>>>25)+e<<0,r+=(h^t&(e^h))+n[1]-389564586,r=(r<<12|r>>>20)+t<<0,h+=(e^r&(t^e))+n[2]+606105819,h=(h<<17|h>>>15)+r<<0,e+=(t^h&(r^t))+n[3]-1044525330,e=(e<<22|e>>>10)+h<<0),t+=(r^e&(h^r))+n[4]-176418897,t=(t<<7|t>>>25)+e<<0,r+=(h^t&(e^h))+n[5]+1200080426,r=(r<<12|r>>>20)+t<<0,h+=(e^r&(t^e))+n[6]-1473231341,h=(h<<17|h>>>15)+r<<0,e+=(t^h&(r^t))+n[7]-45705983,e=(e<<22|e>>>10)+h<<0,t+=(r^e&(h^r))+n[8]+1770035416,t=(t<<7|t>>>25)+e<<0,r+=(h^t&(e^h))+n[9]-1958414417,r=(r<<12|r>>>20)+t<<0,h+=(e^r&(t^e))+n[10]-42063,h=(h<<17|h>>>15)+r<<0,e+=(t^h&(r^t))+n[11]-1990404162,e=(e<<22|e>>>10)+h<<0,t+=(r^e&(h^r))+n[12]+1804603682,t=(t<<7|t>>>25)+e<<0,r+=(h^t&(e^h))+n[13]-40341101,r=(r<<12|r>>>20)+t<<0,h+=(e^r&(t^e))+n[14]-1502002290,h=(h<<17|h>>>15)+r<<0,e+=(t^h&(r^t))+n[15]+1236535329,e=(e<<22|e>>>10)+h<<0,t+=(h^r&(e^h))+n[1]-165796510,t=(t<<5|t>>>27)+e<<0,r+=(e^h&(t^e))+n[6]-1069501632,r=(r<<9|r>>>23)+t<<0,h+=(t^e&(r^t))+n[11]+643717713,h=(h<<14|h>>>18)+r<<0,e+=(r^t&(h^r))+n[0]-373897302,e=(e<<20|e>>>12)+h<<0,t+=(h^r&(e^h))+n[5]-701558691,t=(t<<5|t>>>27)+e<<0,r+=(e^h&(t^e))+n[10]+38016083,r=(r<<9|r>>>23)+t<<0,h+=(t^e&(r^t))+n[15]-660478335,h=(h<<14|h>>>18)+r<<0,e+=(r^t&(h^r))+n[4]-405537848,e=(e<<20|e>>>12)+h<<0,t+=(h^r&(e^h))+n[9]+568446438,t=(t<<5|t>>>27)+e<<0,r+=(e^h&(t^e))+n[14]-1019803690,r=(r<<9|r>>>23)+t<<0,h+=(t^e&(r^t))+n[3]-187363961,h=(h<<14|h>>>18)+r<<0,e+=(r^t&(h^r))+n[8]+1163531501,e=(e<<20|e>>>12)+h<<0,t+=(h^r&(e^h))+n[13]-1444681467,t=(t<<5|t>>>27)+e<<0,r+=(e^h&(t^e))+n[2]-51403784,r=(r<<9|r>>>23)+t<<0,h+=(t^e&(r^t))+n[7]+1735328473,h=(h<<14|h>>>18)+r<<0,e+=(r^t&(h^r))+n[12]-1926607734,e=(e<<20|e>>>12)+h<<0,i=e^h,t+=(i^r)+n[5]-378558,t=(t<<4|t>>>28)+e<<0,r+=(i^t)+n[8]-2022574463,r=(r<<11|r>>>21)+t<<0,s=r^t,h+=(s^e)+n[11]+1839030562,h=(h<<16|h>>>16)+r<<0,e+=(s^h)+n[14]-35309556,e=(e<<23|e>>>9)+h<<0,i=e^h,t+=(i^r)+n[1]-1530992060,t=(t<<4|t>>>28)+e<<0,r+=(i^t)+n[4]+1272893353,r=(r<<11|r>>>21)+t<<0,s=r^t,h+=(s^e)+n[7]-155497632,h=(h<<16|h>>>16)+r<<0,e+=(s^h)+n[10]-1094730640,e=(e<<23|e>>>9)+h<<0,i=e^h,t+=(i^r)+n[13]+681279174,t=(t<<4|t>>>28)+e<<0,r+=(i^t)+n[0]-358537222,r=(r<<11|r>>>21)+t<<0,s=r^t,h+=(s^e)+n[3]-722521979,h=(h<<16|h>>>16)+r<<0,e+=(s^h)+n[6]+76029189,e=(e<<23|e>>>9)+h<<0,i=e^h,t+=(i^r)+n[9]-640364487,t=(t<<4|t>>>28)+e<<0,r+=(i^t)+n[12]-421815835,r=(r<<11|r>>>21)+t<<0,s=r^t,h+=(s^e)+n[15]+530742520,h=(h<<16|h>>>16)+r<<0,e+=(s^h)+n[2]-995338651,e=(e<<23|e>>>9)+h<<0,t+=(h^(e|~r))+n[0]-198630844,t=(t<<6|t>>>26)+e<<0,r+=(e^(t|~h))+n[7]+1126891415,r=(r<<10|r>>>22)+t<<0,h+=(t^(r|~e))+n[14]-1416354905,h=(h<<15|h>>>17)+r<<0,e+=(r^(h|~t))+n[5]-57434055,e=(e<<21|e>>>11)+h<<0,t+=(h^(e|~r))+n[12]+1700485571,t=(t<<6|t>>>26)+e<<0,r+=(e^(t|~h))+n[3]-1894986606,r=(r<<10|r>>>22)+t<<0,h+=(t^(r|~e))+n[10]-1051523,h=(h<<15|h>>>17)+r<<0,e+=(r^(h|~t))+n[1]-2054922799,e=(e<<21|e>>>11)+h<<0,t+=(h^(e|~r))+n[8]+1873313359,t=(t<<6|t>>>26)+e<<0,r+=(e^(t|~h))+n[15]-30611744,r=(r<<10|r>>>22)+t<<0,h+=(t^(r|~e))+n[6]-1560198380,h=(h<<15|h>>>17)+r<<0,e+=(r^(h|~t))+n[13]+1309151649,e=(e<<21|e>>>11)+h<<0,t+=(h^(e|~r))+n[4]-145523070,t=(t<<6|t>>>26)+e<<0,r+=(e^(t|~h))+n[11]-1120210379,r=(r<<10|r>>>22)+t<<0,h+=(t^(r|~e))+n[2]+718787259,h=(h<<15|h>>>17)+r<<0,e+=(r^(h|~t))+n[9]-343485551,e=(e<<21|e>>>11)+h<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=h-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+h<<0,this.h3=this.h3+r<<0)},e.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,h=this.h2,r=this.h3;return o[t>>4&15]+o[15&t]+o[t>>12&15]+o[t>>8&15]+o[t>>20&15]+o[t>>16&15]+o[t>>28&15]+o[t>>24&15]+o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15]+o[h>>4&15]+o[15&h]+o[h>>12&15]+o[h>>8&15]+o[h>>20&15]+o[h>>16&15]+o[h>>28&15]+o[h>>24&15]+o[r>>4&15]+o[15&r]+o[r>>12&15]+o[r>>8&15]+o[r>>20&15]+o[r>>16&15]+o[r>>28&15]+o[r>>24&15]},e.prototype.toString=e.prototype.hex,e.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,h=this.h2,r=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&h,h>>8&255,h>>16&255,h>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},e.prototype.array=e.prototype.digest,e.prototype.buffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t};var b=y();i?module.exports=b:(t.md5=b,s&&define(function(){return b}))}(this);
!function(t){"use strict";function r(t){if(t)c[0]=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0,this.blocks=c,this.buffer8=i;else if(n){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=0,this.finalized=this.hashed=!1,this.first=!0}var e="object"==typeof process&&process.versions&&process.versions.node;e&&(t=global);var i,h=!t.JS_MD5_TEST&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,n=!t.JS_MD5_TEST&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),a=[128,32768,8388608,-2147483648],o=[0,8,16,24],u=["hex","array","digest","buffer","arrayBuffer"],c=[];if(n){var p=new ArrayBuffer(68);i=new Uint8Array(p),c=new Uint32Array(p)}var y=function(t){return function(e){return new r(!0).update(e)[t]()}},d=function(){var t=y("hex");e&&(t=l(t)),t.create=function(){return new r},t.update=function(r){return t.create().update(r)};for(var i=0;i<u.length;++i){var h=u[i];t[h]=y(h)}return t},l=function(r){var e,i;try{if(t.JS_MD5_TEST)throw"JS_MD5_TEST";e=require("crypto"),i=require("buffer").Buffer}catch(h){return console.log(h),r}var s=function(t){if("string"==typeof t)return e.createHash("md5").update(t,"utf8").digest("hex");if(t.constructor==ArrayBuffer)t=new Uint8Array(t);else if(void 0===t.length)return r(t);return e.createHash("md5").update(new i(t)).digest("hex")};return s};r.prototype.update=function(r){if(!this.finalized){var e="string"!=typeof r;e&&r.constructor==t.ArrayBuffer&&(r=new Uint8Array(r));for(var i,h,s=0,f=r.length||0,a=this.blocks,u=this.buffer8;f>s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(n)for(h=this.start;f>s&&64>h;++s)u[h++]=r[s];else for(h=this.start;f>s&&64>h;++s)a[h>>2]|=r[s]<<o[3&h++];else if(n)for(h=this.start;f>s&&64>h;++s)i=r.charCodeAt(s),128>i?u[h++]=i:2048>i?(u[h++]=192|i>>6,u[h++]=128|63&i):55296>i||i>=57344?(u[h++]=224|i>>12,u[h++]=128|i>>6&63,u[h++]=128|63&i):(i=65536+((1023&i)<<10|1023&r.charCodeAt(++s)),u[h++]=240|i>>18,u[h++]=128|i>>12&63,u[h++]=128|i>>6&63,u[h++]=128|63&i);else for(h=this.start;f>s&&64>h;++s)i=r.charCodeAt(s),128>i?a[h>>2]|=i<<o[3&h++]:2048>i?(a[h>>2]|=(192|i>>6)<<o[3&h++],a[h>>2]|=(128|63&i)<<o[3&h++]):55296>i||i>=57344?(a[h>>2]|=(224|i>>12)<<o[3&h++],a[h>>2]|=(128|i>>6&63)<<o[3&h++],a[h>>2]|=(128|63&i)<<o[3&h++]):(i=65536+((1023&i)<<10|1023&r.charCodeAt(++s)),a[h>>2]|=(240|i>>18)<<o[3&h++],a[h>>2]|=(128|i>>12&63)<<o[3&h++],a[h>>2]|=(128|i>>6&63)<<o[3&h++],a[h>>2]|=(128|63&i)<<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}},r.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,this.hash()}},r.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,i=(-1732584194^2004318071&t)+n[1]-117830708,i=(i<<12|i>>>20)+t<<0,e=(-271733879^i&(-271733879^t))+n[2]-1126478375,e=(e<<17|e>>>15)+i<<0,r=(t^e&(i^t))+n[3]-1316259209,r=(r<<22|r>>>10)+e<<0):(t=this.h0,r=this.h1,e=this.h2,i=this.h3,t+=(i^r&(e^i))+n[0]-680876936,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[1]-389564586,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[2]+606105819,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[3]-1044525330,r=(r<<22|r>>>10)+e<<0),t+=(i^r&(e^i))+n[4]-176418897,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[5]+1200080426,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[6]-1473231341,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[7]-45705983,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[8]+1770035416,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[9]-1958414417,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[10]-42063,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[11]-1990404162,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[12]+1804603682,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[13]-40341101,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[14]-1502002290,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[15]+1236535329,r=(r<<22|r>>>10)+e<<0,t+=(e^i&(r^e))+n[1]-165796510,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[6]-1069501632,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[11]+643717713,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[0]-373897302,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[5]-701558691,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[10]+38016083,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[15]-660478335,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[4]-405537848,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[9]+568446438,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[14]-1019803690,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[3]-187363961,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[8]+1163531501,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[13]-1444681467,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[2]-51403784,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[7]+1735328473,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[12]-1926607734,r=(r<<20|r>>>12)+e<<0,h=r^e,t+=(h^i)+n[5]-378558,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[8]-2022574463,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[11]+1839030562,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[14]-35309556,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[1]-1530992060,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[4]+1272893353,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[7]-155497632,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[10]-1094730640,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[13]+681279174,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[0]-358537222,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[3]-722521979,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[6]+76029189,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[9]-640364487,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[12]-421815835,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[15]+530742520,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[2]-995338651,r=(r<<23|r>>>9)+e<<0,t+=(e^(r|~i))+n[0]-198630844,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[7]+1126891415,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[14]-1416354905,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[5]-57434055,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[12]+1700485571,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[3]-1894986606,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[10]-1051523,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[1]-2054922799,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[8]+1873313359,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[15]-30611744,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[6]-1560198380,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[13]+1309151649,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[4]-145523070,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[11]-1120210379,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[2]+718787259,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[9]-343485551,r=(r<<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)},r.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15]+f[r>>4&15]+f[15&r]+f[r>>12&15]+f[r>>8&15]+f[r>>20&15]+f[r>>16&15]+f[r>>28&15]+f[r>>24&15]+f[e>>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15]+f[i>>4&15]+f[15&i]+f[i>>12&15]+f[i>>8&15]+f[i>>20&15]+f[i>>16&15]+f[i>>28&15]+f[i>>24&15]},r.prototype.toString=r.prototype.hex,r.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]},r.prototype.array=r.prototype.digest,r.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},r.prototype.buffer=r.prototype.arrayBuffer;var v=d();h?module.exports=v:(t.md5=v,s&&define(function(){return v}))}(this);

@@ -0,1 +1,6 @@

# v0.4.1 / 2016-03-31
* Removed length detection in node.js.
* Deprecated `buffer` and replace by `arrayBuffer`.
# v0.4.0 / 2015-12-28

@@ -2,0 +7,0 @@

@@ -0,0 +0,0 @@ /*global document */

PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

@@ -0,0 +0,0 @@ var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;

@@ -1,2 +0,2 @@

Copyright 2014-2015 Yi-Cyuan Chen
Copyright 2014-2016 Chen, Yi-Cyuan

@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining

{
"name": "js-md5",
"version": "0.4.0",
"version": "0.4.1",
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",

@@ -34,3 +34,3 @@ "main": "src/md5.js",

"license": "MIT",
"author": "emn178 <emn178@gmail.com>",
"author": "Chen, Yi-Cyuan <emn178@gmail.com>",
"homepage": "https://github.com/emn178/js-md5",

@@ -37,0 +37,0 @@ "bugs": {

# js-md5
[![Build Status](https://travis-ci.org/emn178/js-md5.svg?branch=master)](https://travis-ci.org/emn178/js-md5)
[![Coverage Status](https://coveralls.io/repos/emn178/js-md5/badge.svg?branch=master)](https://coveralls.io/r/emn178/js-md5?branch=master)
[![NPM](https://nodei.co/npm/js-md5.png?stars&downloads)](https://nodei.co/npm/js-md5/)
[![NPM](https://nodei.co/npm/js-md5.png?stars&downloads)](https://nodei.co/npm/js-md5/)
A simple MD5 hash function for JavaScript supports UTF-8 encoding.

@@ -9,3 +10,3 @@

[MD5 Online](http://emn178.github.io/online-tools/md5.html)
[MD5 File Checksum Online](http://emn178.github.io/online-tools/md5_checksum.html)
[MD5 File Checksum Online](http://emn178.github.io/online-tools/md5_checksum.html)

@@ -25,2 +26,5 @@ ## Download

## Notice
`buffer` method is deprecated. This maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.
## Usage

@@ -64,3 +68,4 @@ You could use like this:

md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.buffer(''); // ArrayBuffer
md5.arrayBuffer(''); // ArrayBuffer
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
```

@@ -77,2 +82,2 @@

The project's website is located at https://github.com/emn178/js-md5
Author: Yi-Cyuan Chen (emn178@gmail.com)
Author: Chen, Yi-Cyuan (emn178@gmail.com)

@@ -6,4 +6,4 @@ /**

* @version 0.4.0
* @author Yi-Cyuan Chen [emn178@gmail.com]
* @copyright Yi-Cyuan Chen 2014-2015
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2016
* @license MIT

@@ -24,3 +24,3 @@ */

var SHIFT = [0, 8, 16, 24];
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer'];
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer'];

@@ -64,3 +64,13 @@ var blocks = [], buffer8;

/**
* @method arrayBuffer
* @memberof md5
* @description Output hash as ArrayBuffer
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
* @returns {ArrayBuffer} ArrayBuffer
* @example
* md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
*/
/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof md5

@@ -74,3 +84,3 @@ * @description Output hash as ArrayBuffer

var createOutputMethod = function (outputType) {
return function(message) {
return function (message) {
return new Md5(true).update(message)[outputType]();

@@ -132,11 +142,6 @@ };

if (typeof message == 'string') {
if (message.length <= nodeMethod.utf8Threshold) {
return method(message);
} else if (message.length <= nodeMethod.asciiThreshold && !/[^\x00-\x7F]/.test(message)) {
return method(message);
}
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
} else if (message.constructor == ArrayBuffer) {
message = new Uint8Array(message);
} else if (message.length === undefined || message.length <= nodeMethod.bytesThreshold) {
} else if (message.length === undefined) {
return method(message);

@@ -146,26 +151,2 @@ }

};
/**
* @member {Number} utf8Threshold
* @default 18
* @description To use node.js md5 if UTF-8 string length is greater than this value.
* @memberof md5
*/
nodeMethod.utf8Threshold = 18;
/**
* @member {Number} asciiThreshold
* @default 60
* @description To use node.js md5 if ascii string length is greater than this value.
* @memberof md5
*/
nodeMethod.asciiThreshold = 60;
/**
* @member {Number} bytesThreshold
* @default 245
* @description To use node.js md5 if bytes length is greater than this value.
* @memberof md5
*/
nodeMethod.bytesThreshold = 245;
return nodeMethod;

@@ -216,3 +197,3 @@ };

var notString = typeof(message) != 'string';
if(notString && message.constructor == root.ArrayBuffer) {
if (notString && message.constructor == root.ArrayBuffer) {
message = new Uint8Array(message);

@@ -323,3 +304,3 @@ }

if(this.first) {
if (this.first) {
a = blocks[0] - 680876937;

@@ -477,3 +458,3 @@ a = (a << 7 | a >>> 25) - 271733879 << 0;

if(this.first) {
if (this.first) {
this.h0 = a + 1732584193 << 0;

@@ -547,3 +528,3 @@ this.h1 = b - 271733879 << 0;

*/
Md5.prototype.digest = function() {
Md5.prototype.digest = function () {
this.finalize();

@@ -573,3 +554,3 @@

/**
* @method buffer
* @method arrayBuffer
* @memberof Md5

@@ -579,7 +560,7 @@ * @instance

* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.buffer}
* @see {@link md5.arrayBuffer}
* @example
* hash.buffer();
* hash.arrayBuffer();
*/
Md5.prototype.buffer = function() {
Md5.prototype.arrayBuffer = function () {
this.finalize();

@@ -596,2 +577,15 @@

/**
* @method buffer
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
* @memberof Md5
* @instance
* @description Output hash as ArrayBuffer
* @returns {ArrayBuffer} ArrayBuffer
* @see {@link md5.buffer}
* @example
* hash.buffer();
*/
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
var exports = createMethod();

@@ -598,0 +592,0 @@

@@ -17,3 +17,3 @@ md5 = require('../src/md5.js');

define = function(func) {
define = function (func) {
md5 = func();

@@ -20,0 +20,0 @@ require('./test.js');

@@ -61,2 +61,9 @@ (function (md5) {

if (typeof process == 'object') {
testCases['Buffer'] = {
'd41d8cd98f00b204e9800998ecf8427e': new Buffer(0),
'9e107d9d372bb6826bd81d3542a419d6': new Buffer(new Uint8Array([84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 32, 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101, 114, 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100, 111, 103]))
}
}
var methods = [

@@ -84,2 +91,8 @@ {

{
name: 'md5.arrayBuffer',
call: function (message) {
return md5.arrayBuffer(message).toHexString();
}
},
{
name: 'md5.buffer',

@@ -124,2 +137,8 @@ call: function (message) {

{
name: 'arrayBuffer',
call: function (message) {
return md5.update(message).arrayBuffer().toHexString();
}
},
{
name: 'buffer',

@@ -180,71 +199,2 @@ call: function (message) {

});
// describe('md5', function() {
// describe('ascii', function() {
// describe('less than 64 bytes', function() {
// it('should be successful', function() {
// expect(md5('')).to.be('d41d8cd98f00b204e9800998ecf8427e');
// expect(md5('The quick brown fox jumps over the lazy dog')).to.be('9e107d9d372bb6826bd81d3542a419d6');
// expect(md5('The quick brown fox jumps over the lazy dog.')).to.be('e4d909c290d0fb1ca068ffaddf22cbd0');
// });
// });
// describe('more than 64 bytes', function() {
// it('should be successful', function() {
// expect(md5('The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128-bit (16-byte) hash value, typically expressed in text format as a 32 digit hexadecimal number. MD5 has been utilized in a wide variety of cryptographic applications, and is also commonly used to verify data integrity.')).to.be('f63872ef7bc97a8a8eadba6f0881de53');
// });
// });
// });
// describe('UTF8', function() {
// describe('less than 64 bytes', function() {
// it('should be successful', function() {
// expect(md5('中文')).to.be('a7bac2239fcdcb3a067903d8077c4a07');
// expect(md5('aécio')).to.be('ec3edbf3b05a449fc206a0138c739c3b');
// expect(md5('𠜎')).to.be('b90869aaf121210f6c563973fa855650');
// });
// });
// describe('more than 64 bytes', function() {
// it('should be successful', function() {
// expect(md5('訊息摘要演算法第五版(英語:Message-Digest Algorithm 5,縮寫為MD5),是當前電腦領域用於確保資訊傳輸完整一致而廣泛使用的雜湊演算法之一')).to.be('edce615b179e6e29be23145b77ebbd61');
// expect(md5('訊息摘要演算法第五版(英語:Message-Digest Algorithm 5,縮寫為MD5),是當前電腦領域用於確保資訊傳輸完整一致而廣泛使用的雜湊演算法之一(又譯雜湊演算法、摘要演算法等),主流程式語言普遍已有MD5的實作。')).to.be('ad36c9ab669a0ba9ce46d3ce9134de34');
// });
// });
// });
// describe('special length', function() {
// it('should be successful', function() {
// expect(md5('0123456780123456780123456780123456780123456780123456780')).to.be('a119de63e4b2398427da06dd780263b3');
// expect(md5('01234567801234567801234567801234567801234567801234567801')).to.be('ddafd84ebe63aebc4626b037a569d78b');
// expect(md5('0123456780123456780123456780123456780123456780123456780123456780')).to.be('9ea04d743618797ce464445b5785a630');
// expect(md5('01234567801234567801234567801234567801234567801234567801234567801234567')).to.be('658d914ae42c4938874b2e786ccda479');
// expect(md5('012345678012345678012345678012345678012345678012345678012345678012345678')).to.be('a083a3710d685793f1f17988bfe3c175');
// expect(md5('012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678012345678')).to.be('2b21a843cfc31c8026a0d835bc91bc98');
// });
// });
// });
// describe('Array', function() {
// describe('Array', function() {
// it('should be successful', function() {
// expect(md5([])).to.be('d41d8cd98f00b204e9800998ecf8427e');
// expect(md5([0])).to.be('93b885adfe0da089cdf634904fd59f71');
// expect(md5([84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 32, 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101, 114, 32, 116, 104, 101, 32, 108, 97, 122, 121, 32, 100, 111, 103])).to.be('9e107d9d372bb6826bd81d3542a419d6');
// });
// });
// describe('Uint8Array', function() {
// it('should be successful', function() {
// expect(md5(new Uint8Array([]))).to.be('d41d8cd98f00b204e9800998ecf8427e');
// expect(md5(new Uint8Array(371))).to.be('58f494c2a0fb65332110fb62ae5c4a74');
// });
// });
// describe('ArrayBuffer', function() {
// it('should be successful', function() {
// expect(md5(new ArrayBuffer(0))).to.be('d41d8cd98f00b204e9800998ecf8427e');
// expect(md5(new ArrayBuffer(1))).to.be('93b885adfe0da089cdf634904fd59f71');
// });
// });
// });
})(md5);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc