[Pkg-javascript-commits] [node-sha.js] 139/237: hash: increase verbosity
Bastien Roucariès
rouca at moszumanska.debian.org
Fri May 5 09:03:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-sha.js.
commit b431a1a24d5d37f856592aabe4593196d60b3b7f
Author: Daniel Cousens <github at dcousens.com>
Date: Thu Sep 4 16:57:58 2014 +1000
hash: increase verbosity
---
hash.js | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/hash.js b/hash.js
index c7f690c..0179592 100644
--- a/hash.js
+++ b/hash.js
@@ -15,33 +15,30 @@ module.exports = function (Buffer) {
}
Hash.prototype.update = function (data, enc) {
- var bl = this._blockSize
-
if ("string" === typeof data) {
enc = enc || "utf8"
data = new Buffer(data, enc)
}
- var length = data.length
-
- var l = this._len += length
+ var l = this._len += data.length
var s = this._s = (this._s || 0)
var f = 0
var buffer = this._block
- while(s < l) {
- var t = Math.min(length, f + bl - s%bl)
- var l2 = (t - f)
- for (var i = 0; i < l2; i++) {
- buffer[s%bl + i] = data[i + f]
+ while (s < l) {
+ var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
+ var ch = (t - f)
+
+ for (var i = 0; i < ch; i++) {
+ buffer[(s % this._blockSize) + i] = data[i + f]
}
- var ch = (t - f);
- s += ch;
+ s += ch
f += ch
- if(!(s%bl))
+ if ((s % this._blockSize) === 0) {
this._update(buffer)
+ }
}
this._s = s
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git
More information about the Pkg-javascript-commits
mailing list