aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-12-22 15:44:07 +1100
committerIan Coleman <coleman.ian@gmail.com>2016-12-22 15:44:07 +1100
commit434caecd96740bbec488429026830b5ad24f628a (patch)
tree1b551d1bd3b1903c72c7ddeb3ed685906f062697
parentbf9bdfd20ff1997dc5c53ba5a25f6441b9edd3b7 (diff)
downloadBIP39-434caecd96740bbec488429026830b5ad24f628a.tar.gz
BIP39-434caecd96740bbec488429026830b5ad24f628a.tar.zst
BIP39-434caecd96740bbec488429026830b5ad24f628a.zip
Card entropy changes compiled into standalone
-rw-r--r--bip39-standalone.html15
1 files changed, 10 insertions, 5 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html
index ca18ea8..2888d03 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -522,6 +522,14 @@
522 </span> 522 </span>
523 </p> 523 </p>
524 <p> 524 <p>
525 <strong><span data-translate>Do not store entropy.</span></strong>
526 </p>
527 <p>
528 <span data-translate>Storing entropy (such as keeping a deck of cards in a specific shuffled order) is unreliable compared to storing a mnemonic.</span>
529 <span data-translate>Instead of storing entropy, store the mnemonic generated from the entropy.</span>
530 <span data-translate-html><a href="https://en.wikipedia.org/wiki/Steganography#Physical" target="_blank">Steganography</a> may be beneficial when storing the mnemonic.</span>
531 </p>
532 <p>
525 <span data-translate-html> 533 <span data-translate-html>
526 The random mnemonic generator on this page uses a 534 The random mnemonic generator on this page uses a
527 <a href="https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues" target="_blank">cryptographically secure random number generator</a>. 535 <a href="https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues" target="_blank">cryptographically secure random number generator</a>.
@@ -18584,15 +18592,12 @@ window.Entropy = new (function() {
18584 // Create a normalized string of the selected cards 18592 // Create a normalized string of the selected cards
18585 var normalizedCards = cards.join("").toUpperCase(); 18593 var normalizedCards = cards.join("").toUpperCase();
18586 // Convert to binary using the SHA256 hash of the normalized cards. 18594 // Convert to binary using the SHA256 hash of the normalized cards.
18587 // If the number of bits is more than 256, multiple rounds of hashing 18595 // If the number of bits is more than 256, multiple hashes
18588 // are used until the required number of bits is reached. 18596 // are used until the required number of bits is reached.
18589 var entropyBin = ""; 18597 var entropyBin = "";
18590 var iterations = 0; 18598 var iterations = 0;
18591 while (entropyBin.length < numberOfBits) { 18599 while (entropyBin.length < numberOfBits) {
18592 var hashedCards = sjcl.hash.sha256.hash(normalizedCards); 18600 var hashedCards = sjcl.hash.sha256.hash(normalizedCards + ":" + iterations);
18593 for (var j=0; j<iterations; j++) {
18594 hashedCards = sjcl.hash.sha256.hash(hashedCards);
18595 }
18596 var hashHex = sjcl.codec.hex.fromBits(hashedCards); 18601 var hashHex = sjcl.codec.hex.fromBits(hashedCards);
18597 for (var i=0; i<hashHex.length; i++) { 18602 for (var i=0; i<hashHex.length; i++) {
18598 var decimal = parseInt(hashHex[i], 16); 18603 var decimal = parseInt(hashHex[i], 16);