[Pkg-javascript-commits] [node-sha.js] 49/237: handle large updates all at once, to pass NIST tests

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:02:54 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 f2adc77e49c74d34d8d6715f8b172f3d898bbe32
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Fri Dec 27 16:27:20 2013 +0700

    handle large updates all at once, to pass NIST tests
---
 hash.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hash.js b/hash.js
index a14474b..0911c69 100644
--- a/hash.js
+++ b/hash.js
@@ -40,8 +40,8 @@ Hash.prototype.update = function (data, enc) {
   var f = 0
   while(s < l) {
     var t = Math.min(length, f + bl)
-    u.write(this._block.buffer, data, enc, s%bl, f, t, true)
-    s += (t - f)
+    u.write(this._block.buffer, data, enc, s%bl, f, t)
+    var ch = (t - f); s += ch; f += ch
 
     if(!(s%bl)) {
       this._update(this._block.buffer)
@@ -67,9 +67,9 @@ Hash.prototype.digest = function (enc) {
   var bits = len % (bl*8)
 
   //add end marker, so that appending 0's creats a different hash.
+  //console.log('--- final ---', bits, fl, this._len % bl, fl + 4, fl*8, bits >= fl*8)
+  //console.log(hexpp(x))
   x[this._len % bl] = 0x80
-//  console.log('--- final ---', bits, fl, this._len % bl, fl + 4, fl*8, bits >= fl*8)
-//  console.log(hexpp(x))
   
   if(bits >= fl*8) {
     this._update(this._block.buffer)

-- 
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