mirror of
https://github.com/emn178/js-md5.git
synced 2026-08-13 04:51:44 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f0bd5a888 | ||
|
|
cb8eb73ef1 |
@@ -1,5 +1,13 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## v0.7.2 / 2017-10-31
|
||||||
|
### Improved
|
||||||
|
- performance of hBytes increment.
|
||||||
|
|
||||||
|
## v0.7.1 / 2017-10-29
|
||||||
|
### Fixed
|
||||||
|
- incorrect result when file size >= 4G.
|
||||||
|
|
||||||
## v0.7.0 / 2017-10-29
|
## v0.7.0 / 2017-10-29
|
||||||
### Fixed
|
### Fixed
|
||||||
- incorrect result when file size >= 512M.
|
- incorrect result when file size >= 512M.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md5",
|
"name": "js-md5",
|
||||||
"version": "0.7.0",
|
"version": "0.7.2",
|
||||||
"main": ["src/md5.js"],
|
"main": ["src/md5.js"],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tests"
|
"tests"
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+8
-8
@@ -206,7 +206,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line575">line 575</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line579">line 579</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -326,7 +326,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line587">line 587</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line591">line 591</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -446,7 +446,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line622">line 622</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line626">line 626</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -568,7 +568,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line609">line 609</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line613">line 613</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -688,7 +688,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line553">line 553</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line557">line 557</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -808,7 +808,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line508">line 508</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line512">line 512</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -928,7 +928,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line541">line 541</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line545">line 545</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -1185,7 +1185,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 29 2017 20:15:53 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 31 2017 20:29:31 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+2
-2
@@ -214,7 +214,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="md5.js.html">md5.js</a>, <a href="md5.js.html#line655">line 655</a>
|
<a href="md5.js.html">md5.js</a>, <a href="md5.js.html#line659">line 659</a>
|
||||||
</li></ul></dd>
|
</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e</code></pre>
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 29 2017 20:15:53 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 31 2017 20:29:31 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ md5.base64(''); // 1B2M2Y8AsgTpgAmY7PhCfg==</code></pre><h2>License</h2><p>The p
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 29 2017 20:15:53 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 31 2017 20:29:31 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+2
-2
@@ -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.7.0</li></ul></dd>
|
<dd class="tag-version"><ul class="dummy"><li>0.7.2</li></ul></dd>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1460,7 +1460,7 @@ hash.update('The quick brown fox jumps over the lazy dog');</code></pre>
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 29 2017 20:15:53 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 31 2017 20:29:31 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+8
-4
@@ -30,7 +30,7 @@
|
|||||||
* [js-md5]{@link https://github.com/emn178/js-md5}
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||||||
*
|
*
|
||||||
* @namespace md5
|
* @namespace md5
|
||||||
* @version 0.7.0
|
* @version 0.7.2
|
||||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||||
* @license MIT
|
* @license MIT
|
||||||
@@ -226,7 +226,7 @@
|
|||||||
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = 0;
|
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
|
||||||
this.finalized = this.hashed = false;
|
this.finalized = this.hashed = false;
|
||||||
this.first = true;
|
this.first = true;
|
||||||
}
|
}
|
||||||
@@ -338,6 +338,10 @@
|
|||||||
this.start = i;
|
this.start = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.bytes > 4294967295) {
|
||||||
|
this.hBytes += this.bytes / 4294967296 << 0;
|
||||||
|
this.bytes = this.bytes % 4294967296;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -359,7 +363,7 @@
|
|||||||
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||||
}
|
}
|
||||||
blocks[14] = this.bytes << 3;
|
blocks[14] = this.bytes << 3;
|
||||||
blocks[15] = this.bytes >> 29;
|
blocks[15] = this.hBytes << 3 | this.bytes >> 29;
|
||||||
this.hash();
|
this.hash();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -721,7 +725,7 @@
|
|||||||
<br class="clear">
|
<br class="clear">
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Oct 29 2017 20:15:53 GMT+0800 (CST)
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Oct 31 2017 20:29:31 GMT+0800 (CST)
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script> prettyPrint(); </script>
|
<script> prettyPrint(); </script>
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "js-md5",
|
"name": "js-md5",
|
||||||
"version": "0.7.0",
|
"version": "0.7.2",
|
||||||
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
|
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
|
||||||
"main": "src/md5.js",
|
"main": "src/md5.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+7
-3
@@ -2,7 +2,7 @@
|
|||||||
* [js-md5]{@link https://github.com/emn178/js-md5}
|
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||||||
*
|
*
|
||||||
* @namespace md5
|
* @namespace md5
|
||||||
* @version 0.7.0
|
* @version 0.7.2
|
||||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||||
* @license MIT
|
* @license MIT
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = 0;
|
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
|
||||||
this.finalized = this.hashed = false;
|
this.finalized = this.hashed = false;
|
||||||
this.first = true;
|
this.first = true;
|
||||||
}
|
}
|
||||||
@@ -310,6 +310,10 @@
|
|||||||
this.start = i;
|
this.start = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.bytes > 4294967295) {
|
||||||
|
this.hBytes += this.bytes / 4294967296 << 0;
|
||||||
|
this.bytes = this.bytes % 4294967296;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -331,7 +335,7 @@
|
|||||||
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||||
}
|
}
|
||||||
blocks[14] = this.bytes << 3;
|
blocks[14] = this.bytes << 3;
|
||||||
blocks[15] = this.bytes >> 29;
|
blocks[15] = this.hBytes << 3 | this.bytes >> 29;
|
||||||
this.hash();
|
this.hash();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -241,8 +241,14 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
context('when large size', function () {
|
||||||
|
var hash = md5.create();
|
||||||
|
hash.bytes = 4294967295;
|
||||||
|
hash.update('any');
|
||||||
|
expect(hash.hBytes).to.be(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('#bas64', function () {
|
describe('#bas64', function () {
|
||||||
for (var testCaseName in base64TestCases) {
|
for (var testCaseName in base64TestCases) {
|
||||||
|
|||||||
Reference in New Issue
Block a user