README.md
  1  # MD5
  2  
  3  [![build status](https://secure.travis-ci.org/pvorb/node-md5.png)](http://travis-ci.org/pvorb/node-md5) [![info badge](https://img.shields.io/npm/dt/md5.svg)](http://npm-stat.com/charts.html?package=md5)
  4  
  5  a JavaScript function for hashing messages with MD5.
  6  
  7  node-md5 is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial  
  8  <a href="https://tracking.gitads.io/?repo=node-md5"><img src="https://images.gitads.io/node-md5" alt="GitAds"/></a>
  9  
 10  ## Installation
 11  
 12  You can use this package on the server side as well as the client side.
 13  
 14  ### [Node.js](http://nodejs.org/):
 15  
 16  ~~~
 17  npm install md5
 18  ~~~
 19  
 20  
 21  ## API
 22  
 23  ~~~ javascript
 24  md5(message)
 25  ~~~
 26  
 27    * `message` -- `String`, `Buffer`, `Array` or `Uint8Array`
 28    * returns `String`
 29  
 30  
 31  ## Usage
 32  
 33  ~~~ javascript
 34  var md5 = require('md5');
 35  
 36  console.log(md5('message'));
 37  ~~~
 38  
 39  This will print the following
 40  
 41  ~~~
 42  78e731027d8fd50ed642340b7c9a63b3
 43  ~~~
 44  
 45  It supports buffers, too
 46  
 47  ~~~ javascript
 48  var fs = require('fs');
 49  var md5 = require('md5');
 50  
 51  fs.readFile('example.txt', function(err, buf) {
 52    console.log(md5(buf));
 53  });
 54  ~~~
 55  
 56  ## Versions
 57  
 58  Before version 2.0.0 there were two packages called md5 on npm, one lowercase,
 59  one uppercase (the one you're looking at). As of version 2.0.0, all new versions
 60  of this module will go to lowercase [md5](https://www.npmjs.com/package/md5) on
 61  npm. To use the correct version, users of this module will have to change their
 62  code from `require('MD5')` to `require('md5')` if they want to use versions >=
 63  2.0.0.
 64  
 65  
 66  ## Bugs and Issues
 67  
 68  If you encounter any bugs or issues, feel free to open an issue at
 69  [github](https://github.com/pvorb/node-md5/issues).
 70  
 71  
 72  ## Credits
 73  
 74  This package is based on the work of Jeff Mott, who did a pure JS implementation
 75  of the MD5 algorithm that was published by Ronald L. Rivest in 1991. I needed a
 76  npm package of the algorithm, so I used Jeff’s implementation for this package.
 77  The original implementation can be found in the
 78  [CryptoJS](http://code.google.com/p/crypto-js/) project.
 79  
 80  
 81  ## License
 82  
 83  ~~~
 84  Copyright © 2011-2015, Paul Vorbach.
 85  Copyright © 2009, Jeff Mott.
 86  
 87  All rights reserved.
 88  
 89  Redistribution and use in source and binary forms, with or without modification,
 90  are permitted provided that the following conditions are met:
 91  
 92  * Redistributions of source code must retain the above copyright notice, this
 93    list of conditions and the following disclaimer.
 94  * Redistributions in binary form must reproduce the above copyright notice, this
 95    list of conditions and the following disclaimer in the documentation and/or
 96    other materials provided with the distribution.
 97  * Neither the name Crypto-JS nor the names of its contributors may be used to
 98    endorse or promote products derived from this software without specific prior
 99    written permission.
100  
101  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
102  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
103  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
104  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
105  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
106  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
107  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
108  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
109  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
110  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
111  ~~~