mirror of
https://github.com/emn178/js-md4.git
synced 2026-08-12 20:32:14 +08:00
Fixed ArrayBuffer dosen't work in Webpack.
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
|
/node_modules/
|
||||||
/tests/
|
/tests/
|
||||||
node_modules/
|
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
covreporter
|
/node_modules/
|
||||||
node_modules
|
/covreporter/
|
||||||
|
|||||||
+3
-5
@@ -1,10 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "4.1"
|
- "0.12.15"
|
||||||
- "4.0"
|
- "4.5"
|
||||||
- "0.12"
|
- "6.5.0"
|
||||||
- "0.11"
|
|
||||||
- "0.10"
|
|
||||||
before_install:
|
before_install:
|
||||||
- npm install coveralls
|
- npm install coveralls
|
||||||
- npm install mocha-lcov-reporter
|
- npm install mocha-lcov-reporter
|
||||||
|
|||||||
+21
-13
@@ -1,18 +1,26 @@
|
|||||||
# v0.3.0 / 2015-12-28
|
# Change Log
|
||||||
|
|
||||||
* Added support for update hash.
|
## v0.3.1 / 2017-01-23
|
||||||
* Added support for bytes array output.
|
### Fixed
|
||||||
* Added support for ArrayBuffer output.
|
- ArrayBuffer dosen't work in Webpack.
|
||||||
|
### Deprecated
|
||||||
|
- `buffer` maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.
|
||||||
|
|
||||||
# v0.2.0 / 2015-12-01
|
## v0.3.0 / 2015-12-28
|
||||||
|
### Added
|
||||||
|
- support for update hash.
|
||||||
|
- support for bytes array output.
|
||||||
|
- support for ArrayBuffer output.
|
||||||
|
|
||||||
* Added support for bytes.
|
## v0.2.0 / 2015-12-01
|
||||||
* Added support for AMD.
|
### Added
|
||||||
|
- support for bytes.
|
||||||
|
- support for AMD.
|
||||||
|
|
||||||
# v0.1.1 / 2015-03-01
|
## v0.1.1 / 2015-03-01
|
||||||
|
### Improved
|
||||||
|
- performance.
|
||||||
|
|
||||||
Improve performance.
|
## v0.1.0 / 2015-03-01
|
||||||
|
### Added
|
||||||
# v0.1.0 / 2015-03-01
|
- initial release.
|
||||||
|
|
||||||
Initial release
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
Copyright 2015 Yi-Cyuan Chen
|
Copyright 2015-2017 Yi-Cyuan Chen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ For node.js, you can use this command to install:
|
|||||||
|
|
||||||
npm install js-md4
|
npm install js-md4
|
||||||
|
|
||||||
|
## Notice
|
||||||
|
`buffer` method is deprecated. This maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
You could use like this:
|
You could use like this:
|
||||||
```JavaScript
|
```JavaScript
|
||||||
@@ -30,11 +33,11 @@ hash.hex();
|
|||||||
```
|
```
|
||||||
If you use node.js, you should require the module first:
|
If you use node.js, you should require the module first:
|
||||||
```JavaScript
|
```JavaScript
|
||||||
md4 = require('js-md4');
|
var md4 = require('js-md4');
|
||||||
```
|
```
|
||||||
It supports AMD:
|
It supports AMD:
|
||||||
```JavaScript
|
```JavaScript
|
||||||
require(['your/path/md4.js'], function(md4) {
|
require(['your/path/md4.js'], function (md4) {
|
||||||
// ...
|
// ...
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@@ -58,7 +61,7 @@ md4(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
|||||||
md4.hex(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
md4.hex(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
||||||
md4.array(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
md4.array(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
||||||
md4.digest(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
md4.digest(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
||||||
md4.buffer(''); // ArrayBuffer
|
md4.arrayBuffer(''); // ArrayBuffer
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
@@ -66,4 +69,4 @@ The project is released under the [MIT license](http://www.opensource.org/licens
|
|||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
The project's website is located at https://github.com/emn178/js-md4
|
The project's website is located at https://github.com/emn178/js-md4
|
||||||
Author: Yi-Cyuan Chen
|
Author: Chen, Yi-Cyuan (emn178@gmail.com)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md4",
|
"name": "js-md4",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"main": ["src/md4.js"],
|
"main": ["src/md4.js"],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"samples",
|
"samples",
|
||||||
|
|||||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+127
-9
@@ -91,7 +91,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line113">line 113</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line114">line 114</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line479">line 479</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line480">line 480</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span class="signature">()</span><span class="type-signature"> → {ArrayBuffer}</span></h4>
|
<h4 class="name" id="arrayBuffer"><span class="type-signature"></span>arrayBuffer<span class="signature">()</span><span class="type-signature"> → {ArrayBuffer}</span></h4>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +314,125 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line491">line 491</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line492">line 492</a>
|
||||||
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dt class="tag-see">See:</dt>
|
||||||
|
<dd class="tag-see">
|
||||||
|
<ul>
|
||||||
|
<li>md4.arrayBuffer</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"> → {ArrayBuffer}</span></h4>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="description">
|
||||||
|
Output hash as ArrayBuffer
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dl class="details">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dt class="tag-source">Source:</dt>
|
||||||
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line514">line 514</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -430,7 +548,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line457">line 457</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line458">line 458</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -546,7 +664,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line412">line 412</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line413">line 413</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -662,7 +780,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line445">line 445</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line446">line 446</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -836,7 +954,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line141">line 141</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line142">line 142</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -913,7 +1031,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 11:56:02 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jan 23 2017 15:12:38 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+2
-2
@@ -210,7 +210,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line518">line 518</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line532">line 532</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md4_.html">Md4</a></li></ul><h3>Namespaces</h3><ul><li><a href="md4.html">md4</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md4%2508">md4</a></li></ul>
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md4_.html">Md4</a></li></ul><h3>Namespaces</h3><ul><li><a href="md4.html">md4</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md4%2508">md4</a></li></ul>
|
||||||
|
|||||||
+7
-6
@@ -49,13 +49,14 @@
|
|||||||
<h2>Download</h2><p><a href="https://raw.github.com/emn178/js-md4/master/build/md4.min.js">Compress</a><br><a href="https://raw.github.com/emn178/js-md4/master/src/md4.js">Uncompress</a></p>
|
<h2>Download</h2><p><a href="https://raw.github.com/emn178/js-md4/master/build/md4.min.js">Compress</a><br><a href="https://raw.github.com/emn178/js-md4/master/src/md4.js">Uncompress</a></p>
|
||||||
<h2>Installation</h2><p>You can also install js-md4 by using Bower.</p>
|
<h2>Installation</h2><p>You can also install js-md4 by using Bower.</p>
|
||||||
<pre class="prettyprint source"><code>bower install js-md4</code></pre><p>For node.js, you can use this command to install:</p>
|
<pre class="prettyprint source"><code>bower install js-md4</code></pre><p>For node.js, you can use this command to install:</p>
|
||||||
<pre class="prettyprint source"><code>npm install js-md4</code></pre><h2>Usage</h2><p>You could use like this:</p>
|
<pre class="prettyprint source"><code>npm install js-md4</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>md4('Message to hash');
|
<pre class="prettyprint source lang-JavaScript"><code>md4('Message to hash');
|
||||||
var hash = md4.create();
|
var hash = md4.create();
|
||||||
hash.update('Message to hash');
|
hash.update('Message to hash');
|
||||||
hash.hex();</code></pre><p>If you use node.js, you should require the module first:</p>
|
hash.hex();</code></pre><p>If you use node.js, you should require the module first:</p>
|
||||||
<pre class="prettyprint source lang-JavaScript"><code>md4 = require('js-md4');</code></pre><p>It supports AMD:</p>
|
<pre class="prettyprint source lang-JavaScript"><code>var md4 = require('js-md4');</code></pre><p>It supports AMD:</p>
|
||||||
<pre class="prettyprint source lang-JavaScript"><code>require(['your/path/md4.js'], function(md4) {
|
<pre class="prettyprint source lang-JavaScript"><code>require(['your/path/md4.js'], function (md4) {
|
||||||
// ...
|
// ...
|
||||||
});</code></pre><p><a href="https://emn178.github.com/js-md4/doc/">See document</a></p>
|
});</code></pre><p><a href="https://emn178.github.com/js-md4/doc/">See document</a></p>
|
||||||
<h2>Example</h2><pre class="prettyprint source lang-JavaScript"><code>md4(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
<h2>Example</h2><pre class="prettyprint source lang-JavaScript"><code>md4(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
||||||
@@ -74,8 +75,8 @@ md4(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
|||||||
md4.hex(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
md4.hex(''); // 31d6cfe0d16ae931b73c59d7e0c089c0
|
||||||
md4.array(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
md4.array(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
||||||
md4.digest(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
md4.digest(''); // [49, 214, 207, 224, 209, 106, 233, 49, 183, 60, 89, 215, 224, 192, 137, 192]
|
||||||
md4.buffer(''); // ArrayBuffer</code></pre><h2>License</h2><p>The project is released under the <a href="http://www.opensource.org/licenses/MIT">MIT license</a>.</p>
|
md4.arrayBuffer(''); // ArrayBuffer</code></pre><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-md4<br>Author: Yi-Cyuan Chen</p></article>
|
<h2>Contact</h2><p>The project's website is located at https://github.com/emn178/js-md4<br>Author: Chen, Yi-Cyuan (emn178@gmail.com)</p></article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ md4.buffer(''); // ArrayBuffer</code></pre><h2>License</h2><p>The project is rel
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 11:56:02 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jan 23 2017 15:12:38 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+9
-9
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<dt class="tag-version">Version:</dt>
|
<dt class="tag-version">Version:</dt>
|
||||||
<dd class="tag-version"><ul class="dummy"><li>0.3.0</li></ul></dd>
|
<dd class="tag-version"><ul class="dummy"><li>0.3.1</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<dt class="tag-copyright">Copyright:</dt>
|
<dt class="tag-copyright">Copyright:</dt>
|
||||||
<dd class="tag-copyright"><ul class="dummy"><li>Yi-Cyuan Chen 2015</li></ul></dd>
|
<dd class="tag-copyright"><ul class="dummy"><li>Yi-Cyuan Chen 2015-2027</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line53">line 53</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line54">line 54</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line62">line 62</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line63">line 63</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line77">line 77</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line78">line 78</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -676,7 +676,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line44">line 44</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line45">line 45</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@
|
|||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line33">line 33</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line34">line 34</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -1010,7 +1010,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dt class="tag-source">Source:</dt>
|
<dt class="tag-source">Source:</dt>
|
||||||
<dd class="tag-source"><ul class="dummy"><li>
|
<dd class="tag-source"><ul class="dummy"><li>
|
||||||
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line86">line 86</a>
|
<a href="md4.js.html">md4.js</a>, <a href="md4.js.html#line86">line 86</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
@@ -1085,7 +1085,7 @@
|
|||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md4_.html">Md4</a></li></ul><h3>Namespaces</h3><ul><li><a href="md4.html">md4</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md4%2508">md4</a></li></ul>
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Md4_.html">Md4</a></li></ul><h3>Namespaces</h3><ul><li><a href="md4.html">md4</a></li></ul><h3>Global</h3><ul><li><a href="global.html#md4%2508">md4</a></li></ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
|
|||||||
+35
-21
@@ -30,22 +30,23 @@
|
|||||||
* [js-md4]{@link https://github.com/emn178/js-md4}
|
* [js-md4]{@link https://github.com/emn178/js-md4}
|
||||||
*
|
*
|
||||||
* @namespace md4
|
* @namespace md4
|
||||||
* @version 0.3.0
|
* @version 0.3.1
|
||||||
* @author Yi-Cyuan Chen [emn178@gmail.com]
|
* @author Yi-Cyuan Chen [emn178@gmail.com]
|
||||||
* @copyright Yi-Cyuan Chen 2015
|
* @copyright Yi-Cyuan Chen 2015-2027
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
(function (root) {
|
/*jslint bitwise: true */
|
||||||
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NODE_JS = typeof process == 'object' && process.versions && process.versions.node;
|
var root = typeof window === 'object' ? window : {};
|
||||||
|
var NODE_JS = !root.JS_MD4_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||||
if (NODE_JS) {
|
if (NODE_JS) {
|
||||||
root = global;
|
root = global;
|
||||||
}
|
}
|
||||||
var COMMON_JS = !root.JS_MD4_TEST && typeof module == 'object' && module.exports;
|
var COMMON_JS = !root.JS_MD4_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||||
var AMD = typeof define == 'function' && define.amd;
|
var AMD = typeof define === 'function' && define.amd;
|
||||||
|
var ARRAY_BUFFER = !root.JS_MD4_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||||
var ARRAY_BUFFER = !root.JS_MD4_TEST && typeof ArrayBuffer != 'undefined';
|
|
||||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||||
var EXTRA = [128, 32768, 8388608, -2147483648];
|
var EXTRA = [128, 32768, 8388608, -2147483648];
|
||||||
var SHIFT = [0, 8, 16, 24];
|
var SHIFT = [0, 8, 16, 24];
|
||||||
@@ -130,7 +131,7 @@
|
|||||||
method.update = function (message) {
|
method.update = function (message) {
|
||||||
return method.create().update(message);
|
return method.create().update(message);
|
||||||
};
|
};
|
||||||
for (var i = 0;i < OUTPUT_TYPES.length;++i) {
|
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||||
var type = OUTPUT_TYPES[i];
|
var type = OUTPUT_TYPES[i];
|
||||||
method[type] = createOutputMethod(type);
|
method[type] = createOutputMethod(type);
|
||||||
}
|
}
|
||||||
@@ -179,8 +180,8 @@
|
|||||||
if (this.finalized) {
|
if (this.finalized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var notString = typeof(message) != 'string';
|
var notString = typeof message !== 'string';
|
||||||
if(notString && message.constructor == root.ArrayBuffer) {
|
if(notString && ARRAY_BUFFER && message instanceof ArrayBuffer) {
|
||||||
message = new Uint8Array(message);
|
message = new Uint8Array(message);
|
||||||
}
|
}
|
||||||
var code, index = 0, i, length = message.length || 0, blocks = this.blocks;
|
var code, index = 0, i, length = message.length || 0, blocks = this.blocks;
|
||||||
@@ -198,17 +199,17 @@
|
|||||||
|
|
||||||
if (notString) {
|
if (notString) {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
buffer8[i++] = message[index];
|
buffer8[i++] = message[index];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
buffer8[i++] = code;
|
buffer8[i++] = code;
|
||||||
@@ -228,7 +229,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||||
@@ -517,16 +518,16 @@
|
|||||||
Md4.prototype.array = Md4.prototype.digest;
|
Md4.prototype.array = Md4.prototype.digest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method buffer
|
* @method arrayBuffer
|
||||||
* @memberof Md4
|
* @memberof Md4
|
||||||
* @instance
|
* @instance
|
||||||
* @description Output hash as ArrayBuffer
|
* @description Output hash as ArrayBuffer
|
||||||
* @returns {ArrayBuffer} ArrayBuffer
|
* @returns {ArrayBuffer} ArrayBuffer
|
||||||
* @see {@link md4.buffer}
|
* @see {@link md4.arrayBuffer}
|
||||||
* @example
|
* @example
|
||||||
* hash.buffer();
|
* hash.arrayBuffer();
|
||||||
*/
|
*/
|
||||||
Md4.prototype.buffer = function() {
|
Md4.prototype.arrayBuffer = function() {
|
||||||
this.finalize();
|
this.finalize();
|
||||||
|
|
||||||
var buffer = new ArrayBuffer(16);
|
var buffer = new ArrayBuffer(16);
|
||||||
@@ -538,6 +539,19 @@
|
|||||||
return buffer;
|
return buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method buffer
|
||||||
|
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||||
|
* @memberof Md4
|
||||||
|
* @instance
|
||||||
|
* @description Output hash as ArrayBuffer
|
||||||
|
* @returns {ArrayBuffer} ArrayBuffer
|
||||||
|
* @see {@link md4.buffer}
|
||||||
|
* @example
|
||||||
|
* hash.buffer();
|
||||||
|
*/
|
||||||
|
Md4.prototype.buffer = Md4.prototype.arrayBuffer;
|
||||||
|
|
||||||
var exports = createMethod();
|
var exports = createMethod();
|
||||||
|
|
||||||
if (COMMON_JS) {
|
if (COMMON_JS) {
|
||||||
@@ -567,7 +581,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(this));
|
})();
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
@@ -584,7 +598,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Dec 28 2015 11:56:02 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jan 23 2017 15:12:38 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ h1
|
|||||||
margin: 12px 24px 20px;
|
margin: 12px 24px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2, h3
|
h2, h3.subsection-title
|
||||||
{
|
{
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -161,6 +161,13 @@ h2, h3
|
|||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3
|
||||||
|
{
|
||||||
|
font-size: 24px;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
h4
|
h4
|
||||||
{
|
{
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
@@ -185,6 +192,32 @@ h6
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table
|
||||||
|
{
|
||||||
|
border-spacing: 0;
|
||||||
|
border: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
td, th
|
||||||
|
{
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
margin: 0px;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
padding: 4px 6px;
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead tr
|
||||||
|
{
|
||||||
|
background-color: #ddd;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
th { border-right: 1px solid #aaa; }
|
||||||
|
tr > th:last-child { border-right: 1px solid #ddd; }
|
||||||
|
|
||||||
.ancestors { color: #999; }
|
.ancestors { color: #999; }
|
||||||
.ancestors a
|
.ancestors a
|
||||||
{
|
{
|
||||||
@@ -296,44 +329,12 @@ h6
|
|||||||
user-select: text;
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params, .props
|
|
||||||
{
|
|
||||||
border-spacing: 0;
|
|
||||||
border: 0;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params .name, .props .name, .name code {
|
.params .name, .props .name, .name code {
|
||||||
color: #4D4E53;
|
color: #4D4E53;
|
||||||
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params td, .params th, .props td, .props th
|
|
||||||
{
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
margin: 0px;
|
|
||||||
text-align: left;
|
|
||||||
vertical-align: top;
|
|
||||||
padding: 4px 6px;
|
|
||||||
display: table-cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params thead tr, .props thead tr
|
|
||||||
{
|
|
||||||
background-color: #ddd;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params .params thead tr, .props .props thead tr
|
|
||||||
{
|
|
||||||
background-color: #fff;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.params th, .props th { border-right: 1px solid #aaa; }
|
|
||||||
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
|
|
||||||
|
|
||||||
.params td.description > p:first-child,
|
.params td.description > p:first-child,
|
||||||
.props td.description > p:first-child
|
.props td.description > p:first-child
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md4",
|
"name": "js-md4",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"description": "A simple MD4 hash function for JavaScript supports UTF-8 encoding.",
|
"description": "A simple MD4 hash function for JavaScript supports UTF-8 encoding.",
|
||||||
"main": "src/md4.js",
|
"main": "src/md4.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"HMAC"
|
"HMAC"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "emn178 <emn178@gmail.com>",
|
"author": "Chen, Yi-Cyuan <emn178@gmail.com>",
|
||||||
"homepage": "https://github.com/emn178/js-md4",
|
"homepage": "https://github.com/emn178/js-md4",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/emn178/js-md4/issues"
|
"url": "https://github.com/emn178/js-md4/issues"
|
||||||
|
|||||||
+34
-20
@@ -2,22 +2,23 @@
|
|||||||
* [js-md4]{@link https://github.com/emn178/js-md4}
|
* [js-md4]{@link https://github.com/emn178/js-md4}
|
||||||
*
|
*
|
||||||
* @namespace md4
|
* @namespace md4
|
||||||
* @version 0.3.0
|
* @version 0.3.1
|
||||||
* @author Yi-Cyuan Chen [emn178@gmail.com]
|
* @author Yi-Cyuan Chen [emn178@gmail.com]
|
||||||
* @copyright Yi-Cyuan Chen 2015
|
* @copyright Yi-Cyuan Chen 2015-2027
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
(function (root) {
|
/*jslint bitwise: true */
|
||||||
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var NODE_JS = typeof process == 'object' && process.versions && process.versions.node;
|
var root = typeof window === 'object' ? window : {};
|
||||||
|
var NODE_JS = !root.JS_MD4_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||||
if (NODE_JS) {
|
if (NODE_JS) {
|
||||||
root = global;
|
root = global;
|
||||||
}
|
}
|
||||||
var COMMON_JS = !root.JS_MD4_TEST && typeof module == 'object' && module.exports;
|
var COMMON_JS = !root.JS_MD4_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||||
var AMD = typeof define == 'function' && define.amd;
|
var AMD = typeof define === 'function' && define.amd;
|
||||||
|
var ARRAY_BUFFER = !root.JS_MD4_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||||
var ARRAY_BUFFER = !root.JS_MD4_TEST && typeof ArrayBuffer != 'undefined';
|
|
||||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||||
var EXTRA = [128, 32768, 8388608, -2147483648];
|
var EXTRA = [128, 32768, 8388608, -2147483648];
|
||||||
var SHIFT = [0, 8, 16, 24];
|
var SHIFT = [0, 8, 16, 24];
|
||||||
@@ -102,7 +103,7 @@
|
|||||||
method.update = function (message) {
|
method.update = function (message) {
|
||||||
return method.create().update(message);
|
return method.create().update(message);
|
||||||
};
|
};
|
||||||
for (var i = 0;i < OUTPUT_TYPES.length;++i) {
|
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||||
var type = OUTPUT_TYPES[i];
|
var type = OUTPUT_TYPES[i];
|
||||||
method[type] = createOutputMethod(type);
|
method[type] = createOutputMethod(type);
|
||||||
}
|
}
|
||||||
@@ -151,8 +152,8 @@
|
|||||||
if (this.finalized) {
|
if (this.finalized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var notString = typeof(message) != 'string';
|
var notString = typeof message !== 'string';
|
||||||
if(notString && message.constructor == root.ArrayBuffer) {
|
if(notString && ARRAY_BUFFER && message instanceof ArrayBuffer) {
|
||||||
message = new Uint8Array(message);
|
message = new Uint8Array(message);
|
||||||
}
|
}
|
||||||
var code, index = 0, i, length = message.length || 0, blocks = this.blocks;
|
var code, index = 0, i, length = message.length || 0, blocks = this.blocks;
|
||||||
@@ -170,17 +171,17 @@
|
|||||||
|
|
||||||
if (notString) {
|
if (notString) {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
buffer8[i++] = message[index];
|
buffer8[i++] = message[index];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ARRAY_BUFFER) {
|
if (ARRAY_BUFFER) {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
buffer8[i++] = code;
|
buffer8[i++] = code;
|
||||||
@@ -200,7 +201,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = this.start;index < length && i < 64; ++index) {
|
for (i = this.start; index < length && i < 64; ++index) {
|
||||||
code = message.charCodeAt(index);
|
code = message.charCodeAt(index);
|
||||||
if (code < 0x80) {
|
if (code < 0x80) {
|
||||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||||
@@ -489,16 +490,16 @@
|
|||||||
Md4.prototype.array = Md4.prototype.digest;
|
Md4.prototype.array = Md4.prototype.digest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method buffer
|
* @method arrayBuffer
|
||||||
* @memberof Md4
|
* @memberof Md4
|
||||||
* @instance
|
* @instance
|
||||||
* @description Output hash as ArrayBuffer
|
* @description Output hash as ArrayBuffer
|
||||||
* @returns {ArrayBuffer} ArrayBuffer
|
* @returns {ArrayBuffer} ArrayBuffer
|
||||||
* @see {@link md4.buffer}
|
* @see {@link md4.arrayBuffer}
|
||||||
* @example
|
* @example
|
||||||
* hash.buffer();
|
* hash.arrayBuffer();
|
||||||
*/
|
*/
|
||||||
Md4.prototype.buffer = function() {
|
Md4.prototype.arrayBuffer = function() {
|
||||||
this.finalize();
|
this.finalize();
|
||||||
|
|
||||||
var buffer = new ArrayBuffer(16);
|
var buffer = new ArrayBuffer(16);
|
||||||
@@ -510,6 +511,19 @@
|
|||||||
return buffer;
|
return buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method buffer
|
||||||
|
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||||
|
* @memberof Md4
|
||||||
|
* @instance
|
||||||
|
* @description Output hash as ArrayBuffer
|
||||||
|
* @returns {ArrayBuffer} ArrayBuffer
|
||||||
|
* @see {@link md4.buffer}
|
||||||
|
* @example
|
||||||
|
* hash.buffer();
|
||||||
|
*/
|
||||||
|
Md4.prototype.buffer = Md4.prototype.arrayBuffer;
|
||||||
|
|
||||||
var exports = createMethod();
|
var exports = createMethod();
|
||||||
|
|
||||||
if (COMMON_JS) {
|
if (COMMON_JS) {
|
||||||
@@ -539,4 +553,4 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(this));
|
})();
|
||||||
|
|||||||
+34
-3
@@ -1,12 +1,26 @@
|
|||||||
md4 = require('../src/md4.js');
|
// Node.js env
|
||||||
expect = require('expect.js');
|
expect = require('expect.js');
|
||||||
|
md4 = require('../src/md4.js');
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
|
|
||||||
delete require.cache[require.resolve('../src/md4.js')]
|
delete require.cache[require.resolve('../src/md4.js')]
|
||||||
delete require.cache[require.resolve('./test.js')]
|
delete require.cache[require.resolve('./test.js')]
|
||||||
md4 = null
|
md4 = null
|
||||||
|
|
||||||
JS_MD4_TEST = true;
|
// Webpack browser env
|
||||||
|
JS_MD4_NO_NODE_JS = true;
|
||||||
|
window = global;
|
||||||
|
md4 = require('../src/md4.js');
|
||||||
|
require('./test.js');
|
||||||
|
|
||||||
|
delete require.cache[require.resolve('../src/md4.js')];
|
||||||
|
delete require.cache[require.resolve('./test.js')];
|
||||||
|
md4 = null;
|
||||||
|
|
||||||
|
// browser env
|
||||||
|
JS_MD4_NO_NODE_JS = true;
|
||||||
|
JS_MD4_NO_COMMON_JS = true;
|
||||||
|
window = global;
|
||||||
require('../src/md4.js');
|
require('../src/md4.js');
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
|
|
||||||
@@ -14,7 +28,24 @@ delete require.cache[require.resolve('../src/md4.js')];
|
|||||||
delete require.cache[require.resolve('./test.js')];
|
delete require.cache[require.resolve('./test.js')];
|
||||||
md4 = null;
|
md4 = null;
|
||||||
|
|
||||||
define = function(func) {
|
// browser env and no array buffer
|
||||||
|
JS_MD4_NO_NODE_JS = true;
|
||||||
|
JS_MD4_NO_COMMON_JS = true;
|
||||||
|
JS_MD4_NO_ARRAY_BUFFER = true;
|
||||||
|
window = global;
|
||||||
|
require('../src/md4.js');
|
||||||
|
require('./test.js');
|
||||||
|
|
||||||
|
delete require.cache[require.resolve('../src/md4.js')];
|
||||||
|
delete require.cache[require.resolve('./test.js')];
|
||||||
|
md4 = null;
|
||||||
|
|
||||||
|
// browser AMD
|
||||||
|
JS_MD4_NO_NODE_JS = true;
|
||||||
|
JS_MD4_NO_COMMON_JS = true;
|
||||||
|
JS_MD4_NO_ARRAY_BUFFER = undefined;
|
||||||
|
window = global;
|
||||||
|
define = function (func) {
|
||||||
md4 = func();
|
md4 = func();
|
||||||
require('./test.js');
|
require('./test.js');
|
||||||
};
|
};
|
||||||
|
|||||||
+17
-11
@@ -2,7 +2,7 @@
|
|||||||
Array.prototype.toHexString = ArrayBuffer.prototype.toHexString = function () {
|
Array.prototype.toHexString = ArrayBuffer.prototype.toHexString = function () {
|
||||||
var array = new Uint8Array(this);
|
var array = new Uint8Array(this);
|
||||||
var hex = '';
|
var hex = '';
|
||||||
for (var i = 0;i < array.length;++i) {
|
for (var i = 0; i < array.length; ++i) {
|
||||||
var c = array[i].toString('16');
|
var c = array[i].toString('16');
|
||||||
hex += c.length == 1 ? '0' + c : c;
|
hex += c.length == 1 ? '0' + c : c;
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
'47c61a0fa8738ba77308a8a600f88e4b': new ArrayBuffer(1)
|
'47c61a0fa8738ba77308a8a600f88e4b': new ArrayBuffer(1)
|
||||||
},
|
},
|
||||||
'Object': {
|
'Object': {
|
||||||
'31d6cfe0d16ae931b73c59d7e0c089c0': {},
|
|
||||||
'31d6cfe0d16ae931b73c59d7e0c089c0': {what: 'ever'}
|
'31d6cfe0d16ae931b73c59d7e0c089c0': {what: 'ever'}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -119,9 +118,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'buffer',
|
name: 'arrayBuffer',
|
||||||
call: function (message) {
|
call: function (message) {
|
||||||
return md4.update(message).buffer().toHexString();
|
return md4.update(message).arrayBuffer().toHexString();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -135,14 +134,21 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (typeof JS_MD4_NO_ARRAY_BUFFER !== 'undefined') {
|
||||||
|
classMethods = classMethods.filter(function (method) {
|
||||||
|
return method.name != 'arrayBuffer';
|
||||||
|
});
|
||||||
|
delete testCases['ArrayBuffer'];
|
||||||
|
}
|
||||||
|
|
||||||
methods.forEach(function (method) {
|
methods.forEach(function (method) {
|
||||||
describe('#' + method.name, function() {
|
describe('#' + method.name, function() {
|
||||||
for(var testCaseName in testCases) {
|
for (var testCaseName in testCases) {
|
||||||
(function(testCaseName) {
|
(function (testCaseName) {
|
||||||
var testCase = testCases[testCaseName];
|
var testCase = testCases[testCaseName];
|
||||||
context('when ' + testCaseName, function() {
|
context('when ' + testCaseName, function() {
|
||||||
for(var hash in testCase) {
|
for(var hash in testCase) {
|
||||||
(function(message, hash) {
|
(function (message, hash) {
|
||||||
it('should be equal', function() {
|
it('should be equal', function() {
|
||||||
expect(method.call(message)).to.be(hash);
|
expect(method.call(message)).to.be(hash);
|
||||||
});
|
});
|
||||||
@@ -154,15 +160,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Md4', function() {
|
describe('Md4', function () {
|
||||||
classMethods.forEach(function (method) {
|
classMethods.forEach(function (method) {
|
||||||
describe('#' + method.name, function() {
|
describe('#' + method.name, function() {
|
||||||
for(var testCaseName in testCases) {
|
for (var testCaseName in testCases) {
|
||||||
(function(testCaseName) {
|
(function (testCaseName) {
|
||||||
var testCase = testCases[testCaseName];
|
var testCase = testCases[testCaseName];
|
||||||
context('when ' + testCaseName, function() {
|
context('when ' + testCaseName, function() {
|
||||||
for(var hash in testCase) {
|
for(var hash in testCase) {
|
||||||
(function(message, hash) {
|
(function (message, hash) {
|
||||||
it('should be equal', function() {
|
it('should be equal', function() {
|
||||||
expect(method.call(message)).to.be(hash);
|
expect(method.call(message)).to.be(hash);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user