From 9d33c8925dc07783e2cd819c91eee1144598fcf2 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Thu, 22 Dec 2016 15:40:41 +1100 Subject: [PATCH] Card entropy uses secure hashing when > 256 bits --- src/js/entropy.js | 7 ++----- tests.js | 38 +++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/js/entropy.js b/src/js/entropy.js index 24fc21a..a709c78 100644 --- a/src/js/entropy.js +++ b/src/js/entropy.js @@ -293,15 +293,12 @@ window.Entropy = new (function() { // Create a normalized string of the selected cards var normalizedCards = cards.join("").toUpperCase(); // Convert to binary using the SHA256 hash of the normalized cards. - // If the number of bits is more than 256, multiple rounds of hashing + // If the number of bits is more than 256, multiple hashes // are used until the required number of bits is reached. var entropyBin = ""; var iterations = 0; while (entropyBin.length < numberOfBits) { - var hashedCards = sjcl.hash.sha256.hash(normalizedCards); - for (var j=0; j