Skip to content

Commit 4248c98

Browse files
committed
Fix Node.js usage example.
List Browserify and webpack as supported module loaders.
1 parent 4fca6e0 commit 4248c98

3 files changed

Lines changed: 33 additions & 25 deletions

File tree

README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,36 @@
44
[JavaScript MD5 Demo](https://blueimp.github.io/JavaScript-MD5/)
55

66
## Description
7-
JavaScript MD5 implementation. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.
7+
JavaScript MD5 implementation. Compatible with server-side environments like
8+
Node.js, module loaders like RequireJS, Browserify or webpack and all web
9+
browsers.
810

911
## Usage
1012

1113
### Client-side
12-
Include the (minified) JavaScript [MD5](https://en.wikipedia.org/wiki/MD5) script in your HTML markup:
14+
Include the (minified) JavaScript [MD5](https://en.wikipedia.org/wiki/MD5)
15+
script in your HTML markup:
1316

1417
```html
1518
<script src="js/md5.min.js"></script>
1619
```
1720

18-
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:
21+
In your application code, calculate the
22+
([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded)
23+
[MD5](https://en.wikipedia.org/wiki/MD5) hash of a string by calling the **md5**
24+
method with the string as argument:
1925

2026
```js
2127
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804"
2228
```
2329

2430
### Server-side
2531

26-
The following is an example how to use the JavaScript MD5 module on the server-side with [node.js](http://nodejs.org/).
32+
The following is an example how to use the JavaScript MD5 module on the
33+
server-side with [Node.js](http://nodejs.org/).
2734

28-
Create a new directory and add the **md5.js** file. Or alternatively, install the **blueimp-md5** package with [npm](https://www.npmjs.org/):
35+
Create a new directory and add the **md5.js** file. Or alternatively,
36+
install the **blueimp-md5** package with [npm](https://www.npmjs.org/):
2937

3038
```sh
3139
npm install blueimp-md5
@@ -36,9 +44,9 @@ Add a file **server.js** with the following content:
3644
```js
3745
require("http").createServer(function (req, res) {
3846
// The md5 module exports the md5() function:
39-
var md5 = require("./md5").md5,
47+
var md5 = require("./md5"),
4048
// Use the following version if you installed the package with npm:
41-
// var md5 = require("blueimp-md5").md5,
49+
// var md5 = require("blueimp-md5"),
4250
url = require("url"),
4351
query = url.parse(req.url).query;
4452
res.writeHead(200, {"Content-Type": "text/plain"});
@@ -59,39 +67,46 @@ The JavaScript MD5 script has zero dependencies.
5967

6068
## API
6169

62-
Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded) [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value:
70+
Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded)
71+
[MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value:
6372

6473
```js
6574
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804"
6675
```
6776

68-
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:
77+
Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded)
78+
[HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key:
6979

7080
```js
7181
var hash = md5("value", "key"); // "01433efd5f16327ea4b31144572c67f6"
7282
```
73-
74-
Calculate the raw [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value:
83+
84+
Calculate the raw [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given
85+
string value:
7586

7687
```js
7788
var hash = md5("value", null, true);
7889
```
7990

80-
Calculate the raw [HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and key:
91+
Calculate the raw [HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given
92+
string value and key:
8193

8294
```js
8395
var hash = md5("value", "key", true);
8496
```
8597

8698
## Tests
87-
The JavaScript MD5 project comes with [Unit Tests](https://en.wikipedia.org/wiki/Unit_testing).
99+
The JavaScript MD5 project comes with
100+
[Unit Tests](https://en.wikipedia.org/wiki/Unit_testing).
88101
There are two different ways to run the tests:
89102

90103
* Open test/index.html in your browser or
91104
* run `npm test` in the Terminal in the root path of the repository package.
92105

93-
The first one tests the browser integration, the second one the [node.js](http://nodejs.org/) integration.
106+
The first one tests the browser integration, the second one the
107+
[node.js](http://nodejs.org/) integration.
94108

95109

96110
## License
97-
The JavaScript MD5 script is released under the [MIT license](http://www.opensource.org/licenses/MIT).
111+
The JavaScript MD5 script is released under the
112+
[MIT license](http://www.opensource.org/licenses/MIT).

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
<![endif]-->
1919
<meta charset="utf-8">
2020
<title>JavaScript MD5 Demo</title>
21-
<meta name="description" content="JavaScript MD5 implementation. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.">
21+
<meta name="description" content="JavaScript MD5 implementation. Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.">
2222
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2323
<link rel="stylesheet" href="css/demo.css">
2424
</head>
2525
<body>
2626
<h1>JavaScript MD5 Demo</h1>
2727
<p>JavaScript <a href="https://en.wikipedia.org/wiki/MD5">MD5</a> implementation.<br>
28-
Compatible with server-side environments like <a href="http://nodejs.org/">node.js</a>, module loaders like <a href="http://requirejs.org/">RequireJS</a> and all web browsers.</p>
28+
Compatible with server-side environments like <a href="http://nodejs.org/">Node.js</a>, module loaders like <a href="http://requirejs.org/">RequireJS</a>, <a href="http://browserify.org/">Browserify</a> or <a href="https://webpack.github.io/">webpack</a> and all web browsers.</p>
2929
<ul class="navigation">
3030
<li><a href="https://github.com/blueimp/JavaScript-MD5/tags">Download</a></li>
3131
<li><a href="https://github.com/blueimp/JavaScript-MD5">Source Code</a></li>

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "blueimp-md5",
33
"version": "2.0.0",
44
"title": "JavaScript MD5",
5-
"description": "JavaScript MD5 implementation.",
5+
"description": "JavaScript MD5 implementation. Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.",
66
"keywords": [
77
"javascript",
88
"md5"
@@ -12,12 +12,6 @@
1212
"name": "Sebastian Tschan",
1313
"url": "https://blueimp.net"
1414
},
15-
"maintainers": [
16-
{
17-
"name": "Sebastian Tschan",
18-
"url": "https://blueimp.net"
19-
}
20-
],
2115
"contributors": [
2216
{
2317
"name": "Paul Johnston",
@@ -28,7 +22,6 @@
2822
"type": "git",
2923
"url": "git://github.com/blueimp/JavaScript-MD5.git"
3024
},
31-
"bugs": "https://github.com/blueimp/JavaScript-MD5/issues",
3225
"license": "MIT",
3326
"devDependencies": {
3427
"expect.js": "0.3.1",

0 commit comments

Comments
 (0)