blueimp-md5
Advanced tools
Comparing version 2.10.0 to 2.11.0
242
js/md5.js
@@ -22,10 +22,16 @@ /* | ||
;(function ($) { | ||
/* eslint-disable strict */ | ||
;(function($) { | ||
'use strict' | ||
/* | ||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally | ||
* to work around bugs in some JS interpreters. | ||
*/ | ||
function safeAdd (x, y) { | ||
/** | ||
* Add integers, wrapping at 2^32. | ||
* This uses 16-bit operations internally to work around bugs in interpreters. | ||
* | ||
* @param {number} x First integer | ||
* @param {number} y Second integer | ||
* @returns {number} Sum | ||
*/ | ||
function safeAdd(x, y) { | ||
var lsw = (x & 0xffff) + (y & 0xffff) | ||
@@ -36,35 +42,99 @@ var msw = (x >> 16) + (y >> 16) + (lsw >> 16) | ||
/* | ||
* Bitwise rotate a 32-bit number to the left. | ||
*/ | ||
function bitRotateLeft (num, cnt) { | ||
/** | ||
* Bitwise rotate a 32-bit number to the left. | ||
* | ||
* @param {number} num 32-bit number | ||
* @param {number} cnt Rotation count | ||
* @returns {number} Rotated number | ||
*/ | ||
function bitRotateLeft(num, cnt) { | ||
return (num << cnt) | (num >>> (32 - cnt)) | ||
} | ||
/* | ||
* These functions implement the four basic operations the algorithm uses. | ||
*/ | ||
function md5cmn (q, a, b, x, s, t) { | ||
/** | ||
* Basic operation the algorithm uses. | ||
* | ||
* @param {number} q q | ||
* @param {number} a a | ||
* @param {number} b b | ||
* @param {number} x x | ||
* @param {number} s s | ||
* @param {number} t t | ||
* @returns {number} Result | ||
*/ | ||
function md5cmn(q, a, b, x, s, t) { | ||
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b) | ||
} | ||
function md5ff (a, b, c, d, x, s, t) { | ||
/** | ||
* Basic operation the algorithm uses. | ||
* | ||
* @param {number} a a | ||
* @param {number} b b | ||
* @param {number} c c | ||
* @param {number} d d | ||
* @param {number} x x | ||
* @param {number} s s | ||
* @param {number} t t | ||
* @returns {number} Result | ||
*/ | ||
function md5ff(a, b, c, d, x, s, t) { | ||
return md5cmn((b & c) | (~b & d), a, b, x, s, t) | ||
} | ||
function md5gg (a, b, c, d, x, s, t) { | ||
/** | ||
* Basic operation the algorithm uses. | ||
* | ||
* @param {number} a a | ||
* @param {number} b b | ||
* @param {number} c c | ||
* @param {number} d d | ||
* @param {number} x x | ||
* @param {number} s s | ||
* @param {number} t t | ||
* @returns {number} Result | ||
*/ | ||
function md5gg(a, b, c, d, x, s, t) { | ||
return md5cmn((b & d) | (c & ~d), a, b, x, s, t) | ||
} | ||
function md5hh (a, b, c, d, x, s, t) { | ||
/** | ||
* Basic operation the algorithm uses. | ||
* | ||
* @param {number} a a | ||
* @param {number} b b | ||
* @param {number} c c | ||
* @param {number} d d | ||
* @param {number} x x | ||
* @param {number} s s | ||
* @param {number} t t | ||
* @returns {number} Result | ||
*/ | ||
function md5hh(a, b, c, d, x, s, t) { | ||
return md5cmn(b ^ c ^ d, a, b, x, s, t) | ||
} | ||
function md5ii (a, b, c, d, x, s, t) { | ||
/** | ||
* Basic operation the algorithm uses. | ||
* | ||
* @param {number} a a | ||
* @param {number} b b | ||
* @param {number} c c | ||
* @param {number} d d | ||
* @param {number} x x | ||
* @param {number} s s | ||
* @param {number} t t | ||
* @returns {number} Result | ||
*/ | ||
function md5ii(a, b, c, d, x, s, t) { | ||
return md5cmn(c ^ (b | ~d), a, b, x, s, t) | ||
} | ||
/* | ||
* Calculate the MD5 of an array of little-endian words, and a bit length. | ||
*/ | ||
function binlMD5 (x, len) { | ||
/** | ||
* Calculate the MD5 of an array of little-endian words, and a bit length. | ||
* | ||
* @param {Array} x Array of little-endian words | ||
* @param {number} len Bit length | ||
* @returns {Array<number>} MD5 Array | ||
*/ | ||
function binlMD5(x, len) { | ||
/* append padding */ | ||
x[len >> 5] |= 0x80 << (len % 32) | ||
x[((len + 64) >>> 9 << 4) + 14] = len | ||
x[len >> 5] |= 0x80 << len % 32 | ||
x[(((len + 64) >>> 9) << 4) + 14] = len | ||
@@ -163,6 +233,9 @@ var i | ||
/* | ||
* Convert an array of little-endian words to a string | ||
*/ | ||
function binl2rstr (input) { | ||
/** | ||
* Convert an array of little-endian words to a string | ||
* | ||
* @param {Array<number>} input MD5 Array | ||
* @returns {string} MD5 string | ||
*/ | ||
function binl2rstr(input) { | ||
var i | ||
@@ -172,3 +245,3 @@ var output = '' | ||
for (i = 0; i < length32; i += 8) { | ||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) | ||
output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff) | ||
} | ||
@@ -178,7 +251,10 @@ return output | ||
/* | ||
* Convert a raw string to an array of little-endian words | ||
* Characters >255 have their high-byte silently ignored. | ||
*/ | ||
function rstr2binl (input) { | ||
/** | ||
* Convert a raw string to an array of little-endian words | ||
* Characters >255 have their high-byte silently ignored. | ||
* | ||
* @param {string} input Raw input string | ||
* @returns {Array<number>} Array of little-endian words | ||
*/ | ||
function rstr2binl(input) { | ||
var i | ||
@@ -192,3 +268,3 @@ var output = [] | ||
for (i = 0; i < length8; i += 8) { | ||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) | ||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32 | ||
} | ||
@@ -198,13 +274,20 @@ return output | ||
/* | ||
* Calculate the MD5 of a raw string | ||
*/ | ||
function rstrMD5 (s) { | ||
/** | ||
* Calculate the MD5 of a raw string | ||
* | ||
* @param {string} s Input string | ||
* @returns {string} Raw MD5 string | ||
*/ | ||
function rstrMD5(s) { | ||
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)) | ||
} | ||
/* | ||
* Calculate the HMAC-MD5, of a key and some data (raw strings) | ||
*/ | ||
function rstrHMACMD5 (key, data) { | ||
/** | ||
* Calculates the HMAC-MD5 of a key and some data (raw strings) | ||
* | ||
* @param {string} key HMAC key | ||
* @param {string} data Raw input string | ||
* @returns {string} Raw MD5 string | ||
*/ | ||
function rstrHMACMD5(key, data) { | ||
var i | ||
@@ -227,6 +310,9 @@ var bkey = rstr2binl(key) | ||
/* | ||
* Convert a raw string to a hex string | ||
*/ | ||
function rstr2hex (input) { | ||
/** | ||
* Convert a raw string to a hex string | ||
* | ||
* @param {string} input Raw input string | ||
* @returns {string} Hex encoded string | ||
*/ | ||
function rstr2hex(input) { | ||
var hexTab = '0123456789abcdef' | ||
@@ -243,26 +329,62 @@ var output = '' | ||
/* | ||
* Encode a string as utf-8 | ||
*/ | ||
function str2rstrUTF8 (input) { | ||
/** | ||
* Encode a string as UTF-8 | ||
* | ||
* @param {string} input Input string | ||
* @returns {string} UTF8 string | ||
*/ | ||
function str2rstrUTF8(input) { | ||
return unescape(encodeURIComponent(input)) | ||
} | ||
/* | ||
* Take string arguments and return either raw or hex encoded strings | ||
*/ | ||
function rawMD5 (s) { | ||
/** | ||
* Encodes input string as raw MD5 string | ||
* | ||
* @param {string} s Input string | ||
* @returns {string} Raw MD5 string | ||
*/ | ||
function rawMD5(s) { | ||
return rstrMD5(str2rstrUTF8(s)) | ||
} | ||
function hexMD5 (s) { | ||
/** | ||
* Encodes input string as Hex encoded string | ||
* | ||
* @param {string} s Input string | ||
* @returns {string} Hex encoded string | ||
*/ | ||
function hexMD5(s) { | ||
return rstr2hex(rawMD5(s)) | ||
} | ||
function rawHMACMD5 (k, d) { | ||
/** | ||
* Calculates the raw HMAC-MD5 for the given key and data | ||
* | ||
* @param {string} k HMAC key | ||
* @param {string} d Input string | ||
* @returns {string} Raw MD5 string | ||
*/ | ||
function rawHMACMD5(k, d) { | ||
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)) | ||
} | ||
function hexHMACMD5 (k, d) { | ||
/** | ||
* Calculates the Hex encoded HMAC-MD5 for the given key and data | ||
* | ||
* @param {string} k HMAC key | ||
* @param {string} d Input string | ||
* @returns {string} Raw MD5 string | ||
*/ | ||
function hexHMACMD5(k, d) { | ||
return rstr2hex(rawHMACMD5(k, d)) | ||
} | ||
function md5 (string, key, raw) { | ||
/** | ||
* Calculates MD5 value for a given string. | ||
* If a key is provided, calculates the HMAC-MD5 value. | ||
* Returns a Hex encoded string unless the raw argument is given. | ||
* | ||
* @param {string} string Input string | ||
* @param {string} [key] HMAC key | ||
* @param {boolean} raw Raw oytput switch | ||
* @returns {string} MD5 output | ||
*/ | ||
function md5(string, key, raw) { | ||
if (!key) { | ||
@@ -281,3 +403,3 @@ if (!raw) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(function () { | ||
define(function() { | ||
return md5 | ||
@@ -284,0 +406,0 @@ }) |
@@ -1,2 +0,2 @@ | ||
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this); | ||
!function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d(function(n,t){return n<<t|n>>>32-t}(d(d(t,n),d(e,u)),o),r)}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function i(n,t){var r,e,o,u,c;n[t>>5]|=128<<t%32,n[14+(t+64>>>9<<4)]=t;var f=1732584193,i=-271733879,a=-1732584194,h=271733878;for(r=0;r<n.length;r+=16)i=m(i=m(i=m(i=m(i=v(i=v(i=v(i=v(i=g(i=g(i=g(i=g(i=l(i=l(i=l(i=l(o=i,a=l(u=a,h=l(c=h,f=l(e=f,i,a,h,n[r],7,-680876936),i,a,n[r+1],12,-389564586),f,i,n[r+2],17,606105819),h,f,n[r+3],22,-1044525330),a=l(a,h=l(h,f=l(f,i,a,h,n[r+4],7,-176418897),i,a,n[r+5],12,1200080426),f,i,n[r+6],17,-1473231341),h,f,n[r+7],22,-45705983),a=l(a,h=l(h,f=l(f,i,a,h,n[r+8],7,1770035416),i,a,n[r+9],12,-1958414417),f,i,n[r+10],17,-42063),h,f,n[r+11],22,-1990404162),a=l(a,h=l(h,f=l(f,i,a,h,n[r+12],7,1804603682),i,a,n[r+13],12,-40341101),f,i,n[r+14],17,-1502002290),h,f,n[r+15],22,1236535329),a=g(a,h=g(h,f=g(f,i,a,h,n[r+1],5,-165796510),i,a,n[r+6],9,-1069501632),f,i,n[r+11],14,643717713),h,f,n[r],20,-373897302),a=g(a,h=g(h,f=g(f,i,a,h,n[r+5],5,-701558691),i,a,n[r+10],9,38016083),f,i,n[r+15],14,-660478335),h,f,n[r+4],20,-405537848),a=g(a,h=g(h,f=g(f,i,a,h,n[r+9],5,568446438),i,a,n[r+14],9,-1019803690),f,i,n[r+3],14,-187363961),h,f,n[r+8],20,1163531501),a=g(a,h=g(h,f=g(f,i,a,h,n[r+13],5,-1444681467),i,a,n[r+2],9,-51403784),f,i,n[r+7],14,1735328473),h,f,n[r+12],20,-1926607734),a=v(a,h=v(h,f=v(f,i,a,h,n[r+5],4,-378558),i,a,n[r+8],11,-2022574463),f,i,n[r+11],16,1839030562),h,f,n[r+14],23,-35309556),a=v(a,h=v(h,f=v(f,i,a,h,n[r+1],4,-1530992060),i,a,n[r+4],11,1272893353),f,i,n[r+7],16,-155497632),h,f,n[r+10],23,-1094730640),a=v(a,h=v(h,f=v(f,i,a,h,n[r+13],4,681279174),i,a,n[r],11,-358537222),f,i,n[r+3],16,-722521979),h,f,n[r+6],23,76029189),a=v(a,h=v(h,f=v(f,i,a,h,n[r+9],4,-640364487),i,a,n[r+12],11,-421815835),f,i,n[r+15],16,530742520),h,f,n[r+2],23,-995338651),a=m(a,h=m(h,f=m(f,i,a,h,n[r],6,-198630844),i,a,n[r+7],10,1126891415),f,i,n[r+14],15,-1416354905),h,f,n[r+5],21,-57434055),a=m(a,h=m(h,f=m(f,i,a,h,n[r+12],6,1700485571),i,a,n[r+3],10,-1894986606),f,i,n[r+10],15,-1051523),h,f,n[r+1],21,-2054922799),a=m(a,h=m(h,f=m(f,i,a,h,n[r+8],6,1873313359),i,a,n[r+15],10,-30611744),f,i,n[r+6],15,-1560198380),h,f,n[r+13],21,1309151649),a=m(a,h=m(h,f=m(f,i,a,h,n[r+4],6,-145523070),i,a,n[r+11],10,-1120210379),f,i,n[r+2],15,718787259),h,f,n[r+9],21,-343485551),f=d(f,e),i=d(i,o),a=d(a,u),h=d(h,c);return[f,i,a,h]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function h(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function e(n){var t,r,e="0123456789abcdef",o="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),o+=e.charAt(t>>>4&15)+e.charAt(15&t);return o}function r(n){return unescape(encodeURIComponent(n))}function o(n){return function(n){return a(i(h(n),8*n.length))}(r(n))}function u(n,t){return function(n,t){var r,e,o=h(n),u=[],c=[];for(u[15]=c[15]=void 0,16<o.length&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(h(t)),512+8*t.length),a(i(c.concat(e),640))}(r(n),r(t))}function t(n,t,r){return t?r?u(t,n):function(n,t){return e(u(n,t))}(t,n):r?o(n):function(n){return e(o(n))}(n)}"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:n.md5=t}(this); | ||
//# sourceMappingURL=md5.min.js.map |
@@ -5,8 +5,8 @@ MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
@@ -17,7 +17,6 @@ The above copyright notice and this permission notice shall be included in all | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "blueimp-md5", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"title": "JavaScript MD5", | ||
@@ -27,15 +27,33 @@ "description": "JavaScript MD5 implementation. Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.", | ||
"devDependencies": { | ||
"chai": "^4.1.1", | ||
"eslint": "^4.5.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"mocha": "^3.5.0", | ||
"prettier-eslint-cli": "^4.2.1", | ||
"uglify-js": "^3.0.28" | ||
"chai": "4", | ||
"eslint": "6", | ||
"eslint-config-blueimp": "1", | ||
"eslint-config-prettier": "6", | ||
"eslint-plugin-jsdoc": "15", | ||
"eslint-plugin-prettier": "3", | ||
"mocha": "6", | ||
"prettier": "1", | ||
"uglify-js": "3" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"blueimp", | ||
"plugin:jsdoc/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
} | ||
}, | ||
"eslintIgnore": [ | ||
"js/*.min.js", | ||
"test/vendor" | ||
], | ||
"prettier": { | ||
"proseWrap": "always", | ||
"semi": false, | ||
"singleQuote": true | ||
}, | ||
"scripts": { | ||
"format": "prettier-eslint --no-semi --single-quote --write **/*.js", | ||
"lint": "eslint .", | ||
@@ -49,3 +67,7 @@ "unit": "mocha", | ||
}, | ||
"files": [ | ||
"js/*.js", | ||
"js/*.js.map" | ||
], | ||
"main": "js/md5.js" | ||
} |
# JavaScript MD5 | ||
## Contents | ||
- [Demo](#demo) | ||
- [Description](#description) | ||
- [Usage](#usage) | ||
- [Client-side](#client-side) | ||
- [Server-side](#server-side) | ||
- [Requirements](#requirements) | ||
- [API](#api) | ||
- [Tests](#tests) | ||
- [License](#license) | ||
## Demo | ||
[JavaScript MD5 Demo](https://blueimp.github.io/JavaScript-MD5/) | ||
## Description | ||
JavaScript MD5 implementation. Compatible with server-side environments like | ||
@@ -14,2 +28,3 @@ Node.js, module loaders like RequireJS, Browserify or webpack and all web | ||
### Client-side | ||
Include the (minified) JavaScript [MD5](https://en.wikipedia.org/wiki/MD5) | ||
@@ -28,3 +43,3 @@ script in your HTML markup: | ||
```js | ||
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804" | ||
var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804" | ||
``` | ||
@@ -37,4 +52,4 @@ | ||
Create a new directory and add the **md5.js** file. Or alternatively, | ||
install the **blueimp-md5** package with [npm](https://www.npmjs.org/): | ||
Create a new directory and add the **md5.js** file. Or alternatively, install | ||
the **blueimp-md5** package with [npm](https://www.npmjs.org/): | ||
@@ -48,14 +63,16 @@ ```sh | ||
```js | ||
require("http").createServer(function (req, res) { | ||
require('http') | ||
.createServer(function(req, res) { | ||
// The md5 module exports the md5() function: | ||
var md5 = require("./md5"), | ||
// Use the following version if you installed the package with npm: | ||
// var md5 = require("blueimp-md5"), | ||
url = require("url"), | ||
query = url.parse(req.url).query; | ||
res.writeHead(200, {"Content-Type": "text/plain"}); | ||
var md5 = require('./md5'), | ||
// Use the following version if you installed the package with npm: | ||
// var md5 = require("blueimp-md5"), | ||
url = require('url'), | ||
query = url.parse(req.url).query | ||
res.writeHead(200, { 'Content-Type': 'text/plain' }) | ||
// Calculate and print the MD5 hash of the url query: | ||
res.end(md5(query)); | ||
}).listen(8080, "localhost"); | ||
console.log("Server running at http://localhost:8080/"); | ||
res.end(md5(query)) | ||
}) | ||
.listen(8080, 'localhost') | ||
console.log('Server running at http://localhost:8080/') | ||
``` | ||
@@ -70,2 +87,3 @@ | ||
## Requirements | ||
The JavaScript MD5 script has zero dependencies. | ||
@@ -79,3 +97,3 @@ | ||
```js | ||
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804" | ||
var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804" | ||
``` | ||
@@ -88,3 +106,3 @@ | ||
```js | ||
var hash = md5("value", "key"); // "01433efd5f16327ea4b31144572c67f6" | ||
var hash = md5('value', 'key') // "01433efd5f16327ea4b31144572c67f6" | ||
``` | ||
@@ -96,3 +114,3 @@ | ||
```js | ||
var hash = md5("value", null, true); | ||
var hash = md5('value', null, true) | ||
``` | ||
@@ -104,6 +122,7 @@ | ||
```js | ||
var hash = md5("value", "key", true); | ||
var hash = md5('value', 'key', true) | ||
``` | ||
## Tests | ||
The JavaScript MD5 project comes with | ||
@@ -113,4 +132,4 @@ [Unit Tests](https://en.wikipedia.org/wiki/Unit_testing). | ||
* Open test/index.html in your browser or | ||
* run `npm test` in the Terminal in the root path of the repository package. | ||
- Open test/index.html in your browser or | ||
- run `npm test` in the Terminal in the root path of the repository package. | ||
@@ -120,5 +139,5 @@ The first one tests the browser integration, the second one the | ||
## License | ||
## License | ||
The JavaScript MD5 script is released under the | ||
[MIT license](https://opensource.org/licenses/MIT). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28552
9
394
133