Improved performance of hBytes increment.

pull/22/head v0.7.2
Yi-Cyuan Chen 8 years ago
parent cb8eb73ef1
commit 5f0bd5a888

@ -1,5 +1,9 @@
# Change Log # Change Log
## v0.7.2 / 2017-10-31
### Improved
- performance of hBytes increment.
## v0.7.1 / 2017-10-29 ## v0.7.1 / 2017-10-29
### Fixed ### Fixed
- incorrect result when file size >= 4G. - incorrect result when file size >= 4G.

@ -1,6 +1,6 @@
{ {
"name": "js-md5", "name": "js-md5",
"version": "0.7.1", "version": "0.7.2",
"main": ["src/md5.js"], "main": ["src/md5.js"],
"ignore": [ "ignore": [
"tests" "tests"

4
build/md5.min.js vendored

File diff suppressed because one or more lines are too long

@ -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 21:21:25 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>

@ -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 21:21:25 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>

@ -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 21:21:25 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>

@ -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.1</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 21:21:25 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>

@ -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.1 * @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
@ -330,10 +330,6 @@
} }
this.lastByteIndex = i; this.lastByteIndex = i;
this.bytes += i - this.start; this.bytes += i - this.start;
while (this.bytes > 4294967295) {
++this.hBytes;
this.bytes -= 4294967296;
}
if (i >= 64) { if (i >= 64) {
this.start = i - 64; this.start = i - 64;
this.hash(); this.hash();
@ -342,6 +338,10 @@
this.start = i; this.start = i;
} }
} }
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 &lt;&lt; 0;
this.bytes = this.bytes % 4294967296;
}
return this; return this;
}; };
@ -725,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 21:21:25 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,6 +1,6 @@
{ {
"name": "js-md5", "name": "js-md5",
"version": "0.7.1", "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": {

@ -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.1 * @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
@ -302,10 +302,6 @@
} }
this.lastByteIndex = i; this.lastByteIndex = i;
this.bytes += i - this.start; this.bytes += i - this.start;
while (this.bytes > 4294967295) {
++this.hBytes;
this.bytes -= 4294967296;
}
if (i >= 64) { if (i >= 64) {
this.start = i - 64; this.start = i - 64;
this.hash(); this.hash();
@ -314,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;
}; };

Loading…
Cancel
Save