[Pkg-javascript-commits] [node-md5.js] 10/22: One array instance for all updates

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:56:02 UTC 2017


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

rouca pushed a commit to branch master
in repository node-md5.js.

commit 87e365513da337b923598a2d174c803daa1a27b1
Author: Kirill Fomichev <fanatid at ya.ru>
Date:   Thu Apr 14 10:06:14 2016 +0300

    One array instance for all updates
---
 index.js | 140 ++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 71 insertions(+), 69 deletions(-)

diff --git a/index.js b/index.js
index cf0227c..be62139 100644
--- a/index.js
+++ b/index.js
@@ -2,6 +2,8 @@
 var inherits = require('inherits')
 var HashBase = require('hash-base')
 
+var ARRAY16 = new Array(16)
+
 function MD5 () {
   HashBase.call(this, 64)
 
@@ -15,81 +17,81 @@ function MD5 () {
 inherits(MD5, HashBase)
 
 MD5.prototype._update = function () {
-  var m = new Array(16)
-  for (var i = 0; i < 16; ++i) m[i] = this._block.readInt32LE(i * 4)
+  var M = ARRAY16
+  for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
 
   var a = this._a
   var b = this._b
   var c = this._c
   var d = this._d
 
-  a = fnF(a, b, c, d, m[0], 0xd76aa478, 7)
-  d = fnF(d, a, b, c, m[1], 0xe8c7b756, 12)
-  c = fnF(c, d, a, b, m[2], 0x242070db, 17)
-  b = fnF(b, c, d, a, m[3], 0xc1bdceee, 22)
-  a = fnF(a, b, c, d, m[4], 0xf57c0faf, 7)
-  d = fnF(d, a, b, c, m[5], 0x4787c62a, 12)
-  c = fnF(c, d, a, b, m[6], 0xa8304613, 17)
-  b = fnF(b, c, d, a, m[7], 0xfd469501, 22)
-  a = fnF(a, b, c, d, m[8], 0x698098d8, 7)
-  d = fnF(d, a, b, c, m[9], 0x8b44f7af, 12)
-  c = fnF(c, d, a, b, m[10], 0xffff5bb1, 17)
-  b = fnF(b, c, d, a, m[11], 0x895cd7be, 22)
-  a = fnF(a, b, c, d, m[12], 0x6b901122, 7)
-  d = fnF(d, a, b, c, m[13], 0xfd987193, 12)
-  c = fnF(c, d, a, b, m[14], 0xa679438e, 17)
-  b = fnF(b, c, d, a, m[15], 0x49b40821, 22)
-
-  a = fnG(a, b, c, d, m[1], 0xf61e2562, 5)
-  d = fnG(d, a, b, c, m[6], 0xc040b340, 9)
-  c = fnG(c, d, a, b, m[11], 0x265e5a51, 14)
-  b = fnG(b, c, d, a, m[0], 0xe9b6c7aa, 20)
-  a = fnG(a, b, c, d, m[5], 0xd62f105d, 5)
-  d = fnG(d, a, b, c, m[10], 0x02441453, 9)
-  c = fnG(c, d, a, b, m[15], 0xd8a1e681, 14)
-  b = fnG(b, c, d, a, m[4], 0xe7d3fbc8, 20)
-  a = fnG(a, b, c, d, m[9], 0x21e1cde6, 5)
-  d = fnG(d, a, b, c, m[14], 0xc33707d6, 9)
-  c = fnG(c, d, a, b, m[3], 0xf4d50d87, 14)
-  b = fnG(b, c, d, a, m[8], 0x455a14ed, 20)
-  a = fnG(a, b, c, d, m[13], 0xa9e3e905, 5)
-  d = fnG(d, a, b, c, m[2], 0xfcefa3f8, 9)
-  c = fnG(c, d, a, b, m[7], 0x676f02d9, 14)
-  b = fnG(b, c, d, a, m[12], 0x8d2a4c8a, 20)
-
-  a = fnH(a, b, c, d, m[5], 0xfffa3942, 4)
-  d = fnH(d, a, b, c, m[8], 0x8771f681, 11)
-  c = fnH(c, d, a, b, m[11], 0x6d9d6122, 16)
-  b = fnH(b, c, d, a, m[14], 0xfde5380c, 23)
-  a = fnH(a, b, c, d, m[1], 0xa4beea44, 4)
-  d = fnH(d, a, b, c, m[4], 0x4bdecfa9, 11)
-  c = fnH(c, d, a, b, m[7], 0xf6bb4b60, 16)
-  b = fnH(b, c, d, a, m[10], 0xbebfbc70, 23)
-  a = fnH(a, b, c, d, m[13], 0x289b7ec6, 4)
-  d = fnH(d, a, b, c, m[0], 0xeaa127fa, 11)
-  c = fnH(c, d, a, b, m[3], 0xd4ef3085, 16)
-  b = fnH(b, c, d, a, m[6], 0x04881d05, 23)
-  a = fnH(a, b, c, d, m[9], 0xd9d4d039, 4)
-  d = fnH(d, a, b, c, m[12], 0xe6db99e5, 11)
-  c = fnH(c, d, a, b, m[15], 0x1fa27cf8, 16)
-  b = fnH(b, c, d, a, m[2], 0xc4ac5665, 23)
-
-  a = fnI(a, b, c, d, m[0], 0xf4292244, 6)
-  d = fnI(d, a, b, c, m[7], 0x432aff97, 10)
-  c = fnI(c, d, a, b, m[14], 0xab9423a7, 15)
-  b = fnI(b, c, d, a, m[5], 0xfc93a039, 21)
-  a = fnI(a, b, c, d, m[12], 0x655b59c3, 6)
-  d = fnI(d, a, b, c, m[3], 0x8f0ccc92, 10)
-  c = fnI(c, d, a, b, m[10], 0xffeff47d, 15)
-  b = fnI(b, c, d, a, m[1], 0x85845dd1, 21)
-  a = fnI(a, b, c, d, m[8], 0x6fa87e4f, 6)
-  d = fnI(d, a, b, c, m[15], 0xfe2ce6e0, 10)
-  c = fnI(c, d, a, b, m[6], 0xa3014314, 15)
-  b = fnI(b, c, d, a, m[13], 0x4e0811a1, 21)
-  a = fnI(a, b, c, d, m[4], 0xf7537e82, 6)
-  d = fnI(d, a, b, c, m[11], 0xbd3af235, 10)
-  c = fnI(c, d, a, b, m[2], 0x2ad7d2bb, 15)
-  b = fnI(b, c, d, a, m[9], 0xeb86d391, 21)
+  a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
+  d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
+  c = fnF(c, d, a, b, M[2], 0x242070db, 17)
+  b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
+  a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
+  d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
+  c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
+  b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
+  a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
+  d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
+  c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
+  b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
+  a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
+  d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
+  c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
+  b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
+
+  a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
+  d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
+  c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
+  b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
+  a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
+  d = fnG(d, a, b, c, M[10], 0x02441453, 9)
+  c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
+  b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
+  a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
+  d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
+  c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
+  b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
+  a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
+  d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
+  c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
+  b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
+
+  a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
+  d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
+  c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
+  b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
+  a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
+  d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
+  c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
+  b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
+  a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
+  d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
+  c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
+  b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
+  a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
+  d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
+  c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
+  b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
+
+  a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
+  d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
+  c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
+  b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
+  a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
+  d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
+  c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
+  b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
+  a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
+  d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
+  c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
+  b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
+  a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
+  d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
+  c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
+  b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
 
   this._a = (this._a + a) | 0
   this._b = (this._b + b) | 0

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



More information about the Pkg-javascript-commits mailing list