From fbdafe581ccec51b4f8f67e5ce0b5b439b6eca10 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 9 Jul 2013 23:42:34 -0500 Subject: [PATCH 01/77] Added documentation on how to run the Unit Tests. Removed unnecessary jQuery dependency from the test HTML page. --- README.md | 10 ++++++++++ bower.json | 2 +- package.json | 2 +- test/index.html | 10 +++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a476f40..684b723 100644 --- a/README.md +++ b/README.md @@ -83,5 +83,15 @@ Calculate the raw [HMAC](http://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given var hash = md5("value", "key", true); ``` +## Tests +The JavaScript MD5 project comes with [Unit Tests](http://en.wikipedia.org/wiki/Unit_testing). +There are two different ways to run the tests: + +* Open test/index.html in your browser or +* run `npm test` in the Terminal in the root path of the repository package. + +The first one tests the browser integration, the second one the [node.js](http://nodejs.org/) integration. + + ## License The JavaScript MD5 script is released under the [MIT license](http://www.opensource.org/licenses/MIT). diff --git a/bower.json b/bower.json index 819935b..4166875 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "blueimp-md5", - "version": "1.0.1", + "version": "1.0.2", "title": "JavaScript MD5", "description": "JavaScript MD5 implementation.", "keywords": [ diff --git a/package.json b/package.json index 819935b..4166875 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blueimp-md5", - "version": "1.0.1", + "version": "1.0.2", "title": "JavaScript MD5", "description": "JavaScript MD5 implementation.", "keywords": [ diff --git a/test/index.html b/test/index.html index 29ff520..5f7d27a 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ - + - + diff --git a/js/demo.js b/js/demo.js index 03373ba..96565d3 100644 --- a/js/demo.js +++ b/js/demo.js @@ -1,5 +1,5 @@ /* - * JavaScript MD5 Demo JS 1.0.1 + * JavaScript MD5 Demo JS * https://github.com/blueimp/JavaScript-MD5 * * Copyright 2013, Sebastian Tschan diff --git a/js/md5.js b/js/md5.js index f92ba37..d61eaf3 100644 --- a/js/md5.js +++ b/js/md5.js @@ -1,5 +1,5 @@ /* - * JavaScript MD5 1.0.1 + * JavaScript MD5 * https://github.com/blueimp/JavaScript-MD5 * * Copyright 2011, Sebastian Tschan @@ -7,7 +7,7 @@ * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT - * + * * Based on * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. diff --git a/js/md5.min.js b/js/md5.min.js index 11b1545..ce09ed2 100644 --- a/js/md5.min.js +++ b/js/md5.min.js @@ -1 +1 @@ -!function(a){"use strict";function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b>5]|=(255&a.charCodeAt(b/8))<16&&(e=i(e,8*a.length)),c=0;16>c;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}"function"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this); \ No newline at end of file +!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t),e=(n>>16)+(t>>16)+(r>>16);return e<<16|65535&r}function r(n,t){return n<>>32-t}function e(n,e,u,o,c,f){return t(r(t(t(e,n),t(o,f)),c),u)}function u(n,t,r,u,o,c,f){return e(t&r|~t&u,n,t,o,c,f)}function o(n,t,r,u,o,c,f){return e(t&u|r&~u,n,t,o,c,f)}function c(n,t,r,u,o,c,f){return e(t^r^u,n,t,o,c,f)}function f(n,t,r,u,o,c,f){return e(r^(t|~u),n,t,o,c,f)}function i(n,r){n[r>>5]|=128<>>9<<4)+14]=r;var e,i,a,h,d,g=1732584193,l=-271733879,v=-1732584194,C=271733878;for(e=0;e>5]>>>t%32&255);return r}function h(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t>5]|=(255&n.charCodeAt(t/8))<16&&(u=i(u,8*n.length)),r=0;16>r;r+=1)o[r]=909522486^u[r],c[r]=1549556828^u[r];return e=i(o.concat(h(t)),512+8*t.length),a(i(c.concat(e),640))}function l(n){var t,r,e="0123456789abcdef",u="";for(r=0;r>>4&15)+e.charAt(15&t);return u}function v(n){return unescape(encodeURIComponent(n))}function C(n){return d(v(n))}function m(n){return l(C(n))}function s(n,t){return g(v(n),v(t))}function A(n,t){return l(s(n,t))}function p(n,t,r){return t?r?s(t,n):A(t,n):r?C(n):m(n)}"function"==typeof define&&define.amd?define(function(){return p}):n.md5=p}(this); diff --git a/package.json b/package.json index a589dc3..aa50c82 100644 --- a/package.json +++ b/package.json @@ -31,15 +31,35 @@ "bugs": "https://github.com/blueimp/JavaScript-MD5/issues", "license": "MIT", "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-uglify": "~0.2.7", - "grunt-contrib-jshint": "~0.7.1", - "grunt-bump-build-git": "~1.0.0", - "grunt-simple-mocha": "~0.4.0", - "expect.js": "0.2.0" + "expect.js": "0.3.1", + "jshint": "2.8.0", + "mocha": "2.3.4", + "uglify-js": "2.6.1" }, "scripts": { - "test": "grunt test" + "test": "jshint js test && mocha", + "build": "uglifyjs js/md5.js -c -m > js/md5.min.js", + "preversion": "npm test", + "version": "npm run build && git add -A js", + "postversion": "git push origin master --tags && npm publish" }, - "main": "js/md5.js" + "main": "js/md5.js", + "jshintConfig": { + "bitwise": true, + "curly": true, + "eqeqeq": true, + "forin": true, + "freeze": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "noempty": true, + "nonbsp": true, + "nonew": true, + "quotmark": true, + "undef": true, + "unused": true, + "strict": true + } } diff --git a/test/index.html b/test/index.html index 2c06f4f..a8edd48 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ JavaScript MD5 Demo - +

JavaScript MD5 Demo

JavaScript MD5 implementation.
-Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.

+Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.