[Pkg-javascript-commits] [node-browserify-aes] 27/43: ghash: inline fixup_uint32, and simplify

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 14:41:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browserify-aes.

commit fb33358152bb59912d18476ae5c69dfd2a60e0f8
Author: Daniel Cousens <github at dcousens.com>
Date:   Fri May 19 14:54:44 2017 +1000

    ghash: inline fixup_uint32, and simplify
---
 ghash.js | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/ghash.js b/ghash.js
index 12a961c..8763d31 100644
--- a/ghash.js
+++ b/ghash.js
@@ -77,22 +77,14 @@ function toArray (buf) {
 }
 
 function fromArray (out) {
-  out = out.map(fixup_uint32)
   var buf = Buffer.allocUnsafe(16)
-  buf.writeUInt32BE(out[0], 0)
-  buf.writeUInt32BE(out[1], 4)
-  buf.writeUInt32BE(out[2], 8)
-  buf.writeUInt32BE(out[3], 12)
+  buf.writeUInt32BE(out[0] >>> 0, 0)
+  buf.writeUInt32BE(out[1] >>> 0, 4)
+  buf.writeUInt32BE(out[2] >>> 0, 8)
+  buf.writeUInt32BE(out[3] >>> 0, 12)
   return buf
 }
 
-var uint_max = Math.pow(2, 32)
-function fixup_uint32 (x) {
-  var ret, x_pos
-  ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x
-  return ret
-}
-
 function xor (a, b) {
   return [
     a[0] ^ b[0],

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browserify-aes.git



More information about the Pkg-javascript-commits mailing list