Skip to content

Commit

Permalink
* Removed length detection in node.js.
Browse files Browse the repository at this point in the history
* Deprecated `buffer` and replace by `arrayBuffer`.
  • Loading branch information
Yi-Cyuan committed Mar 31, 2016
1 parent 261e55b commit 5fcee84
Show file tree
Hide file tree
Showing 15 changed files with 335 additions and 347 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v0.4.1 / 2016-03-31

* Removed length detection in node.js.
* Deprecated `buffer` and replace by `arrayBuffer`.

# v0.4.0 / 2015-12-28

* Added support for update hash.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2014-2015 Yi-Cyuan Chen
Copyright 2014-2016 Chen, Yi-Cyuan

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# js-md5
[![Build Status](https://travis-ci.org/emn178/js-md5.svg?branch=master)](https://travis-ci.org/emn178/js-md5)
[![Coverage Status](https://coveralls.io/repos/emn178/js-md5/badge.svg?branch=master)](https://coveralls.io/r/emn178/js-md5?branch=master)
[![NPM](https://nodei.co/npm/js-md5.png?stars&downloads)](https://nodei.co/npm/js-md5/)
[![NPM](https://nodei.co/npm/js-md5.png?stars&downloads)](https://nodei.co/npm/js-md5/)

A simple MD5 hash function for JavaScript supports UTF-8 encoding.

## Demo
[MD5 Online](http://emn178.github.io/online-tools/md5.html)
[MD5 File Checksum Online](http://emn178.github.io/online-tools/md5_checksum.html)
[MD5 File Checksum Online](http://emn178.github.io/online-tools/md5_checksum.html)

## Download
[Compress](https://raw.github.com/emn178/js-md5/master/build/md5.min.js)
Expand All @@ -21,6 +22,9 @@ For node.js, you can use this command to install:

npm install js-md5

## Notice
`buffer` method is deprecated. This maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.

## Usage
You could use like this:
```JavaScript
Expand Down Expand Up @@ -59,7 +63,8 @@ md5(''); // d41d8cd98f00b204e9800998ecf8427e
md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.buffer(''); // ArrayBuffer
md5.arrayBuffer(''); // ArrayBuffer
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
```

## Benchmark
Expand All @@ -71,4 +76,4 @@ The project is released under the [MIT license](http://www.opensource.org/licens

## Contact
The project's website is located at https://github.com/emn178/js-md5
Author: Yi-Cyuan Chen (emn178@gmail.com)
Author: Chen, Yi-Cyuan (emn178@gmail.com)
3 changes: 1 addition & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "js-md5",
"version": "0.4.0",
"version": "0.4.1",
"main": ["src/md5.js"],
"ignore": [
"samples",
"tests"
]
}
6 changes: 3 additions & 3 deletions build/md5.min.js

Large diffs are not rendered by default.

134 changes: 126 additions & 8 deletions doc/Md5_.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h4 class="name" id="Md5"><span class="type-signature"></span>new Md5<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line168">line 168</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line149">line 149</a>
</li></ul></dd>


Expand Down Expand Up @@ -198,7 +198,7 @@ <h4 class="name" id="array"><span class="type-signature"></span>array<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line550">line 550</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line531">line 531</a>
</li></ul></dd>


Expand Down Expand Up @@ -263,6 +263,122 @@ <h5>Example</h5>



<h4 class="name" id="arrayBuffer"><span class="type-signature"></span>arrayBuffer<span class="signature">()</span><span class="type-signature"> &rarr; {ArrayBuffer}</span></h4>





<div class="description">
Output hash as ArrayBuffer
</div>













<dl class="details">


























<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line543">line 543</a>
</li></ul></dd>





<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="md5.html#.arrayBuffer">md5.arrayBuffer</a></li>
</ul>
</dd>



</dl>













<h5>Returns:</h5>


<div class="param-desc">
ArrayBuffer
</div>



<dl>
<dt>
Type
</dt>
<dd>

<span class="param-type">ArrayBuffer</span>


</dd>
</dl>




<h5>Example</h5>

<pre class="prettyprint"><code>hash.arrayBuffer();</code></pre>








<h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span class="signature">()</span><span class="type-signature"> &rarr; {ArrayBuffer}</span></h4>


Expand Down Expand Up @@ -302,6 +418,8 @@ <h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span cla



<dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.</li></ul></dd>




Expand All @@ -314,7 +432,7 @@ <h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line562">line 562</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line565">line 565</a>
</li></ul></dd>


Expand Down Expand Up @@ -430,7 +548,7 @@ <h4 class="name" id="digest"><span class="type-signature"></span>digest<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line528">line 528</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line509">line 509</a>
</li></ul></dd>


Expand Down Expand Up @@ -546,7 +664,7 @@ <h4 class="name" id="hex"><span class="type-signature"></span>hex<span class="si

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line483">line 483</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line464">line 464</a>
</li></ul></dd>


Expand Down Expand Up @@ -662,7 +780,7 @@ <h4 class="name" id="toString"><span class="type-signature"></span>toString<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line516">line 516</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line497">line 497</a>
</li></ul></dd>


Expand Down Expand Up @@ -836,7 +954,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line196">line 196</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line177">line 177</a>
</li></ul></dd>


Expand Down Expand Up @@ -913,7 +1031,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 15:48:48 GMT+0800 (CST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:21 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
Expand Down
15 changes: 3 additions & 12 deletions doc/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line589">line 589</a>
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line583">line 583</a>
</li></ul></dd>


Expand Down Expand Up @@ -259,16 +259,7 @@ <h5>Returns:</h5>

<h5>Example</h5>

<pre class="prettyprint"><code>md5(''); // d41d8cd98f00b204e9800998ecf8427e
md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0

// It also supports UTF-8 encoding
md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07

// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
md5([]); // d41d8cd98f00b204e9800998ecf8427e
md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e</code></pre>
<pre class="prettyprint"><code>md5(''); // d41d8cd98f00b204e9800998ecf8427emd5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0// It also supports UTF-8 encodingmd5('中文'); // a7bac2239fcdcb3a067903d8077c4a07// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`md5([]); // d41d8cd98f00b204e9800998ecf8427emd5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e</code></pre>



Expand All @@ -294,7 +285,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 15:48:48 GMT+0800 (CST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:21 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
Expand Down
15 changes: 9 additions & 6 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ <h3> </h3>

<section>
<article><h1>js-md5</h1><p><a href="https://travis-ci.org/emn178/js-md5"><img src="https://travis-ci.org/emn178/js-md5.svg?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/r/emn178/js-md5?branch=master"><img src="https://coveralls.io/repos/emn178/js-md5/badge.svg?branch=master" alt="Coverage Status"></a><br><a href="https://nodei.co/npm/js-md5/"><img src="https://nodei.co/npm/js-md5.png?stars&amp;downloads" alt="NPM"></a><br>A simple MD5 hash function for JavaScript supports UTF-8 encoding.</p>
<h2>Demo</h2><p><a href="http://emn178.github.io/online-tools/md5.html">MD5 Online</a><br><a href="http://emn178.github.io/online-tools/md5_checksum.html">MD5 File Checksum Online</a> </p>
<a href="https://coveralls.io/r/emn178/js-md5?branch=master"><img src="https://coveralls.io/repos/emn178/js-md5/badge.svg?branch=master" alt="Coverage Status"></a><br><a href="https://nodei.co/npm/js-md5/"><img src="https://nodei.co/npm/js-md5.png?stars&amp;downloads" alt="NPM"></a></p>
<p>A simple MD5 hash function for JavaScript supports UTF-8 encoding.</p>
<h2>Demo</h2><p><a href="http://emn178.github.io/online-tools/md5.html">MD5 Online</a><br><a href="http://emn178.github.io/online-tools/md5_checksum.html">MD5 File Checksum Online</a></p>
<h2>Download</h2><p><a href="https://raw.github.com/emn178/js-md5/master/build/md5.min.js">Compress</a><br><a href="https://raw.github.com/emn178/js-md5/master/src/md5.js">Uncompress</a></p>
<h2>Installation</h2><p>You can also install js-md5 by using Bower.</p>
<pre class="prettyprint source"><code>bower install md5</code></pre><p>For node.js, you can use this command to install:</p>
<pre class="prettyprint source"><code>npm install js-md5</code></pre><h2>Usage</h2><p>You could use like this:</p>
<pre class="prettyprint source"><code>npm install js-md5</code></pre><h2>Notice</h2><p><code>buffer</code> method is deprecated. This maybe confuse with Buffer in node.js. Please use <code>arrayBuffer</code> instead.</p>
<h2>Usage</h2><p>You could use like this:</p>
<pre class="prettyprint source lang-JavaScript"><code>md5('Message to hash');
var hash = md5.create();
hash.update('Message to hash');
Expand All @@ -74,9 +76,10 @@ <h2>Example</h2><pre class="prettyprint source lang-JavaScript"><code>md5(''); /
md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
md5.buffer(''); // ArrayBuffer</code></pre><h2>Benchmark</h2><p><a href="http://jsperf.com/md5-shootout/81">UTF8</a><br><a href="http://jsperf.com/md5-shootout/82">ASCII</a></p>
md5.arrayBuffer(''); // ArrayBuffer
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.</code></pre><h2>Benchmark</h2><p><a href="http://jsperf.com/md5-shootout/81">UTF8</a><br><a href="http://jsperf.com/md5-shootout/82">ASCII</a></p>
<h2>License</h2><p>The project is released under the <a href="http://www.opensource.org/licenses/MIT">MIT license</a>.</p>
<h2>Contact</h2><p>The project's website is located at https://github.com/emn178/js-md5<br>Author: Yi-Cyuan Chen (emn178@gmail.com)</p></article>
<h2>Contact</h2><p>The project's website is located at https://github.com/emn178/js-md5<br>Author: Chen, Yi-Cyuan (emn178@gmail.com)</p></article>
</section>


Expand All @@ -93,7 +96,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md5_.html
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 15:48:48 GMT+0800 (CST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 31 2016 16:24:21 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 5fcee84

Please sign in to comment.