Skip to content

Commit b2399e5

Browse files
committed
Format markdown using prettier.
1 parent 440b330 commit b2399e5

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
# JavaScript MD5
22

3+
## Contents
4+
5+
- [Demo](#demo)
6+
- [Description](#description)
7+
- [Usage](#usage)
8+
- [Client-side](#client-side)
9+
- [Server-side](#server-side)
10+
- [Requirements](#requirements)
11+
- [API](#api)
12+
- [Tests](#tests)
13+
- [License](#license)
14+
315
## Demo
16+
417
[JavaScript MD5 Demo](https://blueimp.github.io/JavaScript-MD5/)
518

619
## Description
20+
721
JavaScript MD5 implementation. Compatible with server-side environments like
822
Node.js, module loaders like RequireJS, Browserify or webpack and all web
923
browsers.
1024

1125
## Usage
1226

1327
### Client-side
28+
1429
Include the (minified) JavaScript [MD5](https://en.wikipedia.org/wiki/MD5)
1530
script in your HTML markup:
1631

@@ -24,16 +39,16 @@ In your application code, calculate the
2439
method with the string as argument:
2540

2641
```js
27-
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804"
42+
var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804"
2843
```
2944

3045
### Server-side
3146

3247
The following is an example how to use the JavaScript MD5 module on the
3348
server-side with [Node.js](http://nodejs.org/).
3449

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/):
50+
Create a new directory and add the **md5.js** file. Or alternatively, install
51+
the **blueimp-md5** package with [npm](https://www.npmjs.org/):
3752

3853
```sh
3954
npm install blueimp-md5
@@ -42,18 +57,20 @@ npm install blueimp-md5
4257
Add a file **server.js** with the following content:
4358

4459
```js
45-
require("http").createServer(function (req, res) {
60+
require('http')
61+
.createServer(function(req, res) {
4662
// The md5 module exports the md5() function:
47-
var md5 = require("./md5"),
48-
// Use the following version if you installed the package with npm:
49-
// var md5 = require("blueimp-md5"),
50-
url = require("url"),
51-
query = url.parse(req.url).query;
52-
res.writeHead(200, {"Content-Type": "text/plain"});
63+
var md5 = require('./md5'),
64+
// Use the following version if you installed the package with npm:
65+
// var md5 = require("blueimp-md5"),
66+
url = require('url'),
67+
query = url.parse(req.url).query
68+
res.writeHead(200, { 'Content-Type': 'text/plain' })
5369
// Calculate and print the MD5 hash of the url query:
54-
res.end(md5(query));
55-
}).listen(8080, "localhost");
56-
console.log("Server running at http://localhost:8080/");
70+
res.end(md5(query))
71+
})
72+
.listen(8080, 'localhost')
73+
console.log('Server running at http://localhost:8080/')
5774
```
5875

5976
Run the application with the following command:
@@ -63,6 +80,7 @@ node server.js
6380
```
6481

6582
## Requirements
83+
6684
The JavaScript MD5 script has zero dependencies.
6785

6886
## API
@@ -71,43 +89,44 @@ Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded)
7189
[MD5](https://en.wikipedia.org/wiki/MD5) hash of a given string value:
7290

7391
```js
74-
var hash = md5("value"); // "2063c1608d6e0baf80249c42e2be5804"
92+
var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804"
7593
```
7694

7795
Calculate the ([hex](https://en.wikipedia.org/wiki/Hexadecimal)-encoded)
7896
[HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given string value and
7997
key:
8098

8199
```js
82-
var hash = md5("value", "key"); // "01433efd5f16327ea4b31144572c67f6"
100+
var hash = md5('value', 'key') // "01433efd5f16327ea4b31144572c67f6"
83101
```
84102

85103
Calculate the raw [MD5](https://en.wikipedia.org/wiki/MD5) hash of a given
86104
string value:
87105

88106
```js
89-
var hash = md5("value", null, true);
107+
var hash = md5('value', null, true)
90108
```
91109

92110
Calculate the raw [HMAC](https://en.wikipedia.org/wiki/HMAC)-MD5 hash of a given
93111
string value and key:
94112

95113
```js
96-
var hash = md5("value", "key", true);
114+
var hash = md5('value', 'key', true)
97115
```
98116

99117
## Tests
118+
100119
The JavaScript MD5 project comes with
101120
[Unit Tests](https://en.wikipedia.org/wiki/Unit_testing).
102121
There are two different ways to run the tests:
103122

104-
* Open test/index.html in your browser or
105-
* run `npm test` in the Terminal in the root path of the repository package.
123+
- Open test/index.html in your browser or
124+
- run `npm test` in the Terminal in the root path of the repository package.
106125

107126
The first one tests the browser integration, the second one the
108127
[node.js](http://nodejs.org/) integration.
109128

110-
111129
## License
130+
112131
The JavaScript MD5 script is released under the
113132
[MIT license](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)