From 4c82568fadd33f3f30f2c5e5659ca9d7f3235648 Mon Sep 17 00:00:00 2001
From: Bart Butler <bart.c.butler@gmail.com>
Date: Wed, 22 Apr 2015 09:35:28 -0700
Subject: [PATCH] hash performance fix

---
 src/crypto/hash/index.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/crypto/hash/index.js b/src/crypto/hash/index.js
index 9ade2a5a..80be7403 100644
--- a/src/crypto/hash/index.js
+++ b/src/crypto/hash/index.js
@@ -7,14 +7,15 @@ var sha = require('./sha.js'),
   rusha = require('./rusha.js'),
   util = require('../../util.js');
 
+var rusha_obj = new rusha();
+
 module.exports = {
   /** @see module:crypto/hash/md5 */
   md5: require('./md5.js'),
   /** @see module:crypto/hash/sha.sha1 */
-  //sha1: sha.sha1,
+  sha1: sha.sha1,
   sha1: function (data) {
-    var r = new rusha();
-    return util.str2Uint8Array(util.hex2bin(r.digest(data)));
+    return util.str2Uint8Array(util.hex2bin(rusha_obj.digest(data)));
   },
   /** @see module:crypto/hash/sha.sha224 */
   sha224: sha.sha224,
@@ -40,9 +41,7 @@ module.exports = {
         return this.md5(data);
       case 2:
         // - SHA-1 [FIPS180]
-        // return this.sha1(data);
-        var r = new rusha();
-        return util.str2Uint8Array(util.hex2bin(r.digest(data)));
+        return this.sha1(data);
       case 3:
         // - RIPE-MD/160 [HAC]
         return this.ripemd(data);