Improved performance of hBytes increment.

This commit is contained in:
Yi-Cyuan Chen
2017-10-31 20:30:01 +08:00
parent cb8eb73ef1
commit 5f0bd5a888
10 changed files with 24 additions and 20 deletions
+5 -5
View File
@@ -2,7 +2,7 @@
* [js-md5]{@link https://github.com/emn178/js-md5}
*
* @namespace md5
* @version 0.7.1
* @version 0.7.2
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
@@ -302,10 +302,6 @@
}
this.lastByteIndex = i;
this.bytes += i - this.start;
while (this.bytes > 4294967295) {
++this.hBytes;
this.bytes -= 4294967296;
}
if (i >= 64) {
this.start = i - 64;
this.hash();
@@ -314,6 +310,10 @@
this.start = i;
}
}
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 << 0;
this.bytes = this.bytes % 4294967296;
}
return this;
};