]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Card entropy uses unicode suit symbols in cleanStr
authorIan Coleman <coleman.ian@gmail.com>
Wed, 9 Nov 2016 23:55:38 +0000 (10:55 +1100)
committerIan Coleman <coleman.ian@gmail.com>
Wed, 9 Nov 2016 23:55:38 +0000 (10:55 +1100)
src/js/entropy.js

index cf981ff680ceae66c9a51f2dc23c84f1ef26d597..db4051bd35fa55777361693c93d59e244addbf86 100644 (file)
@@ -143,6 +143,13 @@ window.Entropy = new (function() {
         // Convert entropy to different formats
         var entropyBin = binLeadingZeros + entropyInt.toString(2);
         var entropyClean = base.parts.join("");
+        if (base.asInt == 52) {
+            entropyClean = base.parts.join(" ").toUpperCase();
+            entropyClean = entropyClean.replace(/C/g, "\u2663");
+            entropyClean = entropyClean.replace(/D/g, "\u2666");
+            entropyClean = entropyClean.replace(/H/g, "\u2665");
+            entropyClean = entropyClean.replace(/S/g, "\u2660");
+        }
         var e = {
             binaryStr: entropyBin,
             cleanStr: entropyClean,