[Pkg-javascript-commits] [node-sha.js] 75/237: tidy

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:03:37 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 2c664aadf9008111c8f19d30f0b8125d0133b79c
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Mon Jan 6 08:42:36 2014 +0700

    tidy
---
 hash.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hash.js b/hash.js
index fcd8066..11fc0c7 100644
--- a/hash.js
+++ b/hash.js
@@ -1,6 +1,8 @@
 var u = require('./util')
-var hexpp = require('./hexpp').defaults({bigendian: false})
+var write = u.write
+var fill = u.zeroFill
 var toBuffer = require('bops/typedarray/from')
+
 module.exports = Hash
 
 //prototype class for hash functions
@@ -46,14 +48,15 @@ Hash.prototype.update = function (data, enc) {
   var l = this._len += length
   var s = this._s = (this._s || 0)
   var f = 0
+  var buffer = this._block.buffer
   while(s < l) {
     var t = Math.min(length, f + bl)
-    u.write(this._block.buffer, data, enc, s%bl, f, t)
+    write(buffer, data, enc, s%bl, f, t)
     var ch = (t - f);
     s += ch; f += ch
 
     if(!(s%bl))
-      this._update(this._block.buffer)
+      this._update(buffer)
   }
   this._s = s
 
@@ -76,7 +79,7 @@ Hash.prototype.digest = function (enc) {
   //console.log('--- final ---', bits, fl, this._len % bl, fl + 4, fl*8, bits >= fl*8)
   //console.log(hexpp(x))
   x[this._len % bl] = 0x80
-  u.zeroFill(this._block.buffer, this._len % bl + 1)
+  fill(this._block.buffer, this._len % bl + 1)
   
   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