From aca490f4089543bf685ef452eb4a1e5e8f610f64 Mon Sep 17 00:00:00 2001 From: Chris Moore Date: Sun, 28 Feb 2016 13:17:14 -0800 Subject: [PATCH] Allow more than 99 dice to be rolled. Use privkey%256 as the private key. Replace '6' by '0' in the entered string, so the user doesn't have to. --- bitaddress.org.html | 12 ++++++------ src/bitaddress-ui.html | 4 ++-- src/bitcoinjs-lib.eckey.js | 6 +++--- src/ninja.detailwallet.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bitaddress.org.html b/bitaddress.org.html index 7a4cffa..3286482 100644 --- a/bitaddress.org.html +++ b/bitaddress.org.html @@ -5726,7 +5726,7 @@ Bitcoin.ECKey = (function () { } if (ECKey.isBase6Format(input)) { - this.priv = new BigInteger(input, 6); + this.priv = new BigInteger(input.replace(/6/g, '0'), 6).and(BigInteger.ONE.shiftLeft(256).subtract(BigInteger.ONE)); } else if (bytes == null || bytes.length != 32) { this.priv = null; } else { @@ -5947,10 +5947,10 @@ Bitcoin.ECKey = (function () { return (/^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=+\/]{44}$/.test(key)); }; - // 99 characters, 1=1, if using dice convert 6 to 0 + // 99 or more characters, 1=1, if using dice convert 6 to 0 ECKey.isBase6Format = function (key) { key = key.toString(); - return (/^[012345]{99}$/.test(key)); + return (/^[0-6]{99,}$/.test(key)); }; // 22, 26 or 30 characters, always starts with an 'S' @@ -6972,7 +6972,7 @@ input[type=checkbox] { position: relative; z-index: 20; } -
An important part of creating a Bitcoin wallet is ensuring the random numbers used to create the wallet are truly random. Physical randomness is better than computer generated pseudo-randomness. The easiest way to generate physical randomness is with dice. To create a Bitcoin private key you only need one six sided die which you roll 99 times. Stopping each time to record the value of the die. When recording the values follow these rules: 1=1, 2=2, 3=3, 4=4, 5=5, 6=0. By doing this you are recording the big random number, your private key, in B6 or base 6 format. You can then enter the 99 character base 6 private key into the text field above and click View Details. You will then see the Bitcoin address associated with your private key. You should also make note of your private key in WIF format since it is more widely used.
+
An important part of creating a Bitcoin wallet is ensuring the random numbers used to create the wallet are truly random. Physical randomness is better than computer generated pseudo-randomness. The easiest way to generate physical randomness is with dice. To create a Bitcoin private key you only need one six sided die which you roll 99 or more times. Stopping each time to record the value of the die. Each 6 will automatically be replaced by a 0. By doing this you are recording the big random number, your private key, in B6 or base 6 format. You can then enter the base 6 private key into the text field above and click View Details. You will then see the Bitcoin address associated with your private key. You should also make note of your private key in WIF format since it is more widely used.
@@ -10433,7 +10433,7 @@ ninja.wallets.vanitywallet = { checkAndShowBase6: function (key) { if (Bitcoin.ECKey.isBase6Format(key)) { // show Private Key Base6 Format - document.getElementById("detailprivb6").innerHTML = key; + document.getElementById("detailprivb6").innerHTML = key.replace(/6/g, '0'); document.getElementById("detailb6").style.display = "block"; } }, diff --git a/src/bitaddress-ui.html b/src/bitaddress-ui.html index 0d69c53..03fd8fe 100644 --- a/src/bitaddress-ui.html +++ b/src/bitaddress-ui.html @@ -456,7 +456,7 @@ -
An important part of creating a Bitcoin wallet is ensuring the random numbers used to create the wallet are truly random. Physical randomness is better than computer generated pseudo-randomness. The easiest way to generate physical randomness is with dice. To create a Bitcoin private key you only need one six sided die which you roll 99 times. Stopping each time to record the value of the die. When recording the values follow these rules: 1=1, 2=2, 3=3, 4=4, 5=5, 6=0. By doing this you are recording the big random number, your private key, in B6 or base 6 format. You can then enter the 99 character base 6 private key into the text field above and click View Details. You will then see the Bitcoin address associated with your private key. You should also make note of your private key in WIF format since it is more widely used.
+
An important part of creating a Bitcoin wallet is ensuring the random numbers used to create the wallet are truly random. Physical randomness is better than computer generated pseudo-randomness. The easiest way to generate physical randomness is with dice. To create a Bitcoin private key you only need one six sided die which you roll 99 or more times. Stopping each time to record the value of the die. Each 6 will automatically be replaced by a 0. By doing this you are recording the big random number, your private key, in B6 or base 6 format. You can then enter the base 6 private key into the text field above and click View Details. You will then see the Bitcoin address associated with your private key. You should also make note of your private key in WIF format since it is more widely used.
diff --git a/src/bitcoinjs-lib.eckey.js b/src/bitcoinjs-lib.eckey.js index e1ab37d..17c18ed 100644 --- a/src/bitcoinjs-lib.eckey.js +++ b/src/bitcoinjs-lib.eckey.js @@ -104,7 +104,7 @@ Bitcoin.ECKey = (function () { } if (ECKey.isBase6Format(input)) { - this.priv = new BigInteger(input, 6); + this.priv = new BigInteger(input.replace(/6/g, '0'), 6).and(BigInteger.ONE.shiftLeft(256).subtract(BigInteger.ONE)); } else if (bytes == null || bytes.length != 32) { this.priv = null; } else { @@ -325,10 +325,10 @@ Bitcoin.ECKey = (function () { return (/^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=+\/]{44}$/.test(key)); }; - // 99 characters, 1=1, if using dice convert 6 to 0 + // 99 or more characters, 1=1, if using dice convert 6 to 0 ECKey.isBase6Format = function (key) { key = key.toString(); - return (/^[012345]{99}$/.test(key)); + return (/^[0-6]{99,}$/.test(key)); }; // 22, 26 or 30 characters, always starts with an 'S' diff --git a/src/ninja.detailwallet.js b/src/ninja.detailwallet.js index bfe86e6..28ba647 100644 --- a/src/ninja.detailwallet.js +++ b/src/ninja.detailwallet.js @@ -43,7 +43,7 @@ checkAndShowBase6: function (key) { if (Bitcoin.ECKey.isBase6Format(key)) { // show Private Key Base6 Format - document.getElementById("detailprivb6").innerHTML = key; + document.getElementById("detailprivb6").innerHTML = key.replace(/6/g, '0'); document.getElementById("detailb6").style.display = "block"; } },