File: readme.md

package info (click to toggle)
node-md5-hex 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 104 kB
  • sloc: makefile: 2; sh: 2
file content (46 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# md5-hex [![Build Status](https://travis-ci.org/sindresorhus/md5-hex.svg?branch=master)](https://travis-ci.org/sindresorhus/md5-hex)

> Create a MD5 hash with hex encoding

*Please don't use MD5 hashes for anything sensitive!*

Works in the browser too, when used with browserify/webpack.

Checkout [`hasha`](https://github.com/sindresorhus/hasha) if you need something more flexible.


## Install

```
$ npm install --save md5-hex
```


## Usage

```js
const fs = require('fs');
const md5Hex = require('md5-hex');
const buffer = fs.readFileSync('unicorn.png');

md5Hex(buffer);
//=> '1abcb33beeb811dca15f0ac3e47b88d9'
```


## API

### md5Hex(input)

#### input

Type: `Buffer` `string` `Buffer[]` `string[]`

Prefer buffers as they're faster to hash, but strings can be useful for small things.

Pass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation.


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)