From 299407012031ac6f60f832d3b5fa975fcb88b550 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Thu, 15 Aug 2013 11:01:14 -0500 Subject: [PATCH 01/76] Removed scripts section from bower.json. --- bower.json | 5 +---- package.json | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 4166875..37e2ac5 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "blueimp-md5", - "version": "1.0.2", + "version": "1.0.3", "title": "JavaScript MD5", "description": "JavaScript MD5 implementation.", "keywords": [ @@ -40,8 +40,5 @@ "expect.js": "0.2.0", "uglify-js": "2.3.6" }, - "scripts": { - "test": "mocha --reporter spec" - }, "main": "js/md5.js" } diff --git a/package.json b/package.json index 4166875..1779948 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blueimp-md5", - "version": "1.0.2", + "version": "1.0.3", "title": "JavaScript MD5", "description": "JavaScript MD5 implementation.", "keywords": [ From dc11908b0aec3fbc6e3161020caab7dd619aa11e Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Tue, 12 Nov 2013 18:10:13 +0100 Subject: [PATCH 02/76] Replaced Makefile with Grunt tasks. --- Gruntfile.js | 69 ++++++++++++++++++++++++++++++++++++ Makefile | 6 ---- bower.json | 85 ++++++++++++++++++++++---------------------- js/md5.min.js | 2 +- package.json | 94 ++++++++++++++++++++++++++----------------------- test/index.html | 6 ++-- 6 files changed, 166 insertions(+), 96 deletions(-) create mode 100644 Gruntfile.js delete mode 100644 Makefile diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..98c9cfc --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,69 @@ +/* + * JavaScript MD5 Gruntfile + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +/*global module */ + +module.exports = function (grunt) { + 'use strict'; + + grunt.initConfig({ + jshint: { + all: [ + 'Gruntfile.js', + 'js/demo.js', + 'js/md5.js', + 'test/test.js' + ] + }, + simplemocha: { + options: { + ignoreLeaks: false, + ui: 'bdd', + reporter: 'spec' + }, + all: { + src: ['test/test.js'] + } + }, + mocha: { + all: { + src: ['test/index.html'], + options: { + run: true, + bail: true, + log: true, + reporter: 'Spec' + }, + mocha: { + ignoreLeaks: false + } + } + }, + uglify: { + production: { + src: [ + 'js/md5.js' + ], + dest: 'js/md5.min.js' + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-simple-mocha'); + grunt.loadNpmTasks('grunt-mocha'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-bump-build-git'); + + grunt.registerTask('test', ['jshint', 'simplemocha', 'mocha']); + grunt.registerTask('default', ['test', 'uglify']); + +}; diff --git a/Makefile b/Makefile deleted file mode 100644 index a196ee8..0000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -.PHONY: default js - -default: js - -js: - node_modules/.bin/uglifyjs js/md5.js -c -m -o js/md5.min.js diff --git a/bower.json b/bower.json index 37e2ac5..1bad9ff 100644 --- a/bower.json +++ b/bower.json @@ -1,44 +1,45 @@ { - "name": "blueimp-md5", - "version": "1.0.3", - "title": "JavaScript MD5", - "description": "JavaScript MD5 implementation.", - "keywords": [ - "javascript", - "md5" - ], - "homepage": "https://github.com/blueimp/JavaScript-MD5", - "author": { - "name": "Sebastian Tschan", - "url": "https://blueimp.net" - }, - "maintainers": [ - { - "name": "Sebastian Tschan", - "url": "https://blueimp.net" - } - ], - "contributors": [ - { - "name": "Paul Johnston", - "url": "http://pajhome.org.uk/crypt/md5" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/blueimp/JavaScript-MD5.git" - }, - "bugs": "https://github.com/blueimp/JavaScript-MD5/issues", - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "devDependencies": { - "mocha": "1.11.0", - "expect.js": "0.2.0", - "uglify-js": "2.3.6" - }, - "main": "js/md5.js" + "name": "blueimp-md5", + "version": "1.1.0", + "title": "JavaScript MD5", + "description": "JavaScript MD5 implementation.", + "keywords": [ + "javascript", + "md5" + ], + "homepage": "https://github.com/blueimp/JavaScript-MD5", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "maintainers": [ + { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + } + ], + "contributors": [ + { + "name": "Paul Johnston", + "url": "http://pajhome.org.uk/crypt/md5" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/blueimp/JavaScript-MD5.git" + }, + "bugs": "https://github.com/blueimp/JavaScript-MD5/issues", + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "main": "js/md5.js", + "ignore": [ + "/*.*", + "css", + "js/demo.js", + "test" + ] } diff --git a/js/md5.min.js b/js/md5.min.js index a571fa1..11b1545 100644 --- a/js/md5.min.js +++ b/js/md5.min.js @@ -1 +1 @@ -!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);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)+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); \ No newline at end of file +!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 diff --git a/package.json b/package.json index 1779948..ebc4b3f 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,51 @@ { - "name": "blueimp-md5", - "version": "1.0.3", - "title": "JavaScript MD5", - "description": "JavaScript MD5 implementation.", - "keywords": [ - "javascript", - "md5" - ], - "homepage": "https://github.com/blueimp/JavaScript-MD5", - "author": { - "name": "Sebastian Tschan", - "url": "https://blueimp.net" - }, - "maintainers": [ - { - "name": "Sebastian Tschan", - "url": "https://blueimp.net" - } - ], - "contributors": [ - { - "name": "Paul Johnston", - "url": "http://pajhome.org.uk/crypt/md5" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/blueimp/JavaScript-MD5.git" - }, - "bugs": "https://github.com/blueimp/JavaScript-MD5/issues", - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "devDependencies": { - "mocha": "1.11.0", - "expect.js": "0.2.0", - "uglify-js": "2.3.6" - }, - "scripts": { - "test": "mocha --reporter spec" - }, - "main": "js/md5.js" + "name": "blueimp-md5", + "version": "1.1.0", + "title": "JavaScript MD5", + "description": "JavaScript MD5 implementation.", + "keywords": [ + "javascript", + "md5" + ], + "homepage": "https://github.com/blueimp/JavaScript-MD5", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "maintainers": [ + { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + } + ], + "contributors": [ + { + "name": "Paul Johnston", + "url": "http://pajhome.org.uk/crypt/md5" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/blueimp/JavaScript-MD5.git" + }, + "bugs": "https://github.com/blueimp/JavaScript-MD5/issues", + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/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", + "grunt-mocha": "~0.4.1", + "expect.js": "0.2.0" + }, + "scripts": { + "test": "grunt test" + }, + "main": "js/md5.js" } diff --git a/test/index.html b/test/index.html index 5f7d27a..a9a6ad1 100644 --- a/test/index.html +++ b/test/index.html @@ -31,8 +31,10 @@ From 8d6c346db5f4fba256511e19f07076ae170fb076 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 14 Sep 2014 00:19:20 +0100 Subject: [PATCH 03/76] Use https for the demo. --- README.md | 18 +++++++++--------- index.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 684b723..77a0849 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JavaScript MD5 ## Demo -[JavaScript MD5 Demo](http://blueimp.github.io/JavaScript-MD5/) +[JavaScript MD5 Demo](https://blueimp.github.io/JavaScript-MD5/) ## Description JavaScript MD5 implementation. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers. @@ -9,13 +9,13 @@ JavaScript MD5 implementation. Compatible with server-side environments like nod ## Usage ### Client-side -Include the (minified) JavaScript [MD5](http://en.wikipedia.org/wiki/MD5) script in your HTML markup: +Include the (minified) JavaScript [MD5](https://en.wikipedia.org/wiki/MD5) script in your HTML markup: ```html ``` -In your application code, calculate the ([hex](http://en.wikipedia.org/wiki/Hexadecimal)-encoded) [MD5](http://en.wikipedia.org/wiki/MD5) hash of a string by calling the **md5** method with the string as argument: +In your application code, calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded) [MD5](https://en.wikipedia.org/wiki/MD5) hash of a string by calling the **md5** method with the string as argument: ```js var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804" @@ -25,7 +25,7 @@ var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804" The following is an example how to use the JavaScript MD5 module on the server-side with [node.js](http://nodejs.org/). -Create a new directory and add the **md5.js** file. Or alternatively, install the **blueimp-md5** package with [npm](http://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/): ```sh npm install blueimp-md5 @@ -59,32 +59,32 @@ The JavaScript MD5 script has zero dependencies. ## API -Calculate the ([hex](http://en.wikipedia.org/wiki/Hexadecimal)-encoded) [MD5](http://en.wikipedia.org/wiki/MD5) hash of a given string value: +Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded) [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value: ```js var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804" ``` -Calculate the ([hex](http://en.wikipedia.org/wiki/Hexadecimal)-encoded) [HMAC](http://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key: +Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded) [HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key: ```js var hash = md5("value", "key"); // "01433efd5f16327ea4b31144572c67f6" ``` -Calculate the raw [MD5](http://en.wikipedia.org/wiki/MD5) hash of a given string value: +Calculate the raw [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value: ```js var hash = md5("value", null, true); ``` -Calculate the raw [HMAC](http://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key: +Calculate the raw [HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key: ```js var hash = md5("value", "key", true); ``` ## Tests -The JavaScript MD5 project comes with [Unit Tests](http://en.wikipedia.org/wiki/Unit_testing). +The JavaScript MD5 project comes with [Unit Tests](https://en.wikipedia.org/wiki/Unit_testing). There are two different ways to run the tests: * Open test/index.html in your browser or diff --git a/index.html b/index.html index e6c44f9..80b1893 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@

JavaScript MD5 Demo

-

JavaScript MD5 implementation.
+

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