- // If using hex, should always be multiples of 4 bits, which can get
- // out of sync if first number has leading 0 bits, eg 2 in hex is 0010
- // which would show up as 10, thus missing 2 bits it should have.
- if (base.asInt == 16) {
- var firstDigit = parseInt(base.parts[0], 16);
- if (firstDigit >= 4 && firstDigit < 8) {
- binLeadingZeros += "0";
- }
- else if (firstDigit >= 2 && firstDigit < 4) {
- binLeadingZeros += "00";
- }
- else if (firstDigit >= 1 && firstDigit < 2) {
- binLeadingZeros += "000";
- }
+ // Supply a 'filtered' entropy string for display purposes
+ var entropyClean = base.parts.join("");
+ var entropyHtml = 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");
+ entropyHtml = base.parts.join(" ").toUpperCase();
+ entropyHtml = entropyHtml.replace(/C/g, "<span class='card-suit club'>\u2663</span>");
+ entropyHtml = entropyHtml.replace(/D/g, "<span class='card-suit diamond'>\u2666</span>");
+ entropyHtml = entropyHtml.replace(/H/g, "<span class='card-suit heart'>\u2665</span>");
+ entropyHtml = entropyHtml.replace(/S/g, "<span class='card-suit spade'>\u2660</span>");