diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/entropy.js | 7 |
1 files changed, 2 insertions, 5 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() { | |||
293 | // Create a normalized string of the selected cards | 293 | // Create a normalized string of the selected cards |
294 | var normalizedCards = cards.join("").toUpperCase(); | 294 | var normalizedCards = cards.join("").toUpperCase(); |
295 | // Convert to binary using the SHA256 hash of the normalized cards. | 295 | // Convert to binary using the SHA256 hash of the normalized cards. |
296 | // If the number of bits is more than 256, multiple rounds of hashing | 296 | // If the number of bits is more than 256, multiple hashes |
297 | // are used until the required number of bits is reached. | 297 | // are used until the required number of bits is reached. |
298 | var entropyBin = ""; | 298 | var entropyBin = ""; |
299 | var iterations = 0; | 299 | var iterations = 0; |
300 | while (entropyBin.length < numberOfBits) { | 300 | while (entropyBin.length < numberOfBits) { |
301 | var hashedCards = sjcl.hash.sha256.hash(normalizedCards); | 301 | var hashedCards = sjcl.hash.sha256.hash(normalizedCards + ":" + iterations); |
302 | for (var j=0; j<iterations; j++) { | ||
303 | hashedCards = sjcl.hash.sha256.hash(hashedCards); | ||
304 | } | ||
305 | var hashHex = sjcl.codec.hex.fromBits(hashedCards); | 302 | var hashHex = sjcl.codec.hex.fromBits(hashedCards); |
306 | for (var i=0; i<hashHex.length; i++) { | 303 | for (var i=0; i<hashHex.length; i++) { |
307 | var decimal = parseInt(hashHex[i], 16); | 304 | var decimal = parseInt(hashHex[i], 16); |