Compare commits

...

16 Commits
0.3.3 ... 0.3.4

Author SHA1 Message Date
Ian Coleman
fca07769eb Release v0.3.4 2018-03-12 11:48:10 +11:00
Ian Coleman
5028988195 Use correct BIP44 value for Denarius of 116, not 0
See https://github.com/satoshilabs/slips/blob/master/slip-0044.md
2018-03-12 11:41:35 +11:00
Ian Coleman
139becaf2c Add Korean language 2018-03-12 11:31:41 +11:00
Ian Coleman
0514c20b81 Update jsbip39.js to latest version 2018-03-12 11:31:41 +11:00
Ian Coleman
f8ca25c338 Add spacing every 11 bits to the checksum 2018-03-12 11:31:41 +11:00
Ian Coleman
548d94994b Warn that entropy values should exclude checksum 2018-03-12 11:31:41 +11:00
Ian Coleman
09d63290a4 Show the checksum value in the entropy details 2018-03-12 11:31:41 +11:00
Ian Coleman
d6cade868f Add spaces every 11 bits to raw binary of entropy
This makes it easier to see that the checksum is missing from the end of
the entropy.
2018-03-12 11:31:41 +11:00
Ian Coleman
048721a6ff Add test for blackcoin 2018-03-12 11:31:41 +11:00
Ian Coleman
892ce76fed Order blackcoin alphabetically in coin list 2018-03-12 11:31:41 +11:00
iancoleman
aaa82c097f Merge pull request #172 from carsenk/master
Add Denarius (DNR) Support
2018-03-12 11:21:17 +11:00
iancoleman
05311e7f54 Merge pull request #163 from janko33bd/blackcoin
Add Blackcoin please
2018-03-12 09:23:17 +11:00
carsenk
40209fd898 Add DNR Support 2018-03-06 01:11:55 -07:00
janko33bd
e5520bb859 typo 2018-02-07 19:27:35 +01:00
janko33bd
e1d0cf4f72 update index.js with correct BIP44 reg. number 2018-02-07 19:26:26 +01:00
janko33bd
e82a142872 make bitcoinjs-extensions black 2018-02-07 19:20:54 +01:00
9 changed files with 4340 additions and 27 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,12 @@
# 0.3.4
* Add BlackCoin
* Add Denarius
* Raw entropy shows groupings with space every 11 bits
* Checksum shown in entropy details
* Warn that entropy values should exclude checksum
* Add Korean language
# 0.3.3
* Add AXE network

View File

@@ -15,7 +15,7 @@
<div class="container">
<h1 class="text-center">Mnemonic Code Converter</h1>
<p class="version">v0.3.3</p>
<p class="version">v0.3.4</p>
<hr>
<div class="row">
<div class="col-md-12">
@@ -94,6 +94,8 @@
<div class="filtered col-sm-9 form-control-static"></div>
<label class="col-sm-3 control-label">Raw Binary</label>
<div class="binary col-sm-9 form-control-static"></div>
<label class="col-sm-3 control-label">Binary Checksum</label>
<div class="checksum col-sm-9 form-control-static">&nbsp;</div>
<label class="col-sm-3 control-label">Word Indexes</label>
<div class="word-indexes col-sm-9 form-control-static">&nbsp;</div>
<label class="col-sm-3 control-label">Mnemonic Length</label>
@@ -141,6 +143,7 @@
<a href="#chinese_traditional" title="Chinese (Traditional)">中文(繁體)</a>
<a href="#french" title="French">Français</a>
<a href="#italian" title="Italian">Italiano</a>
<a href="#korean" title="Korean">한국어</a>
</div>
</div>
</div>
@@ -713,6 +716,9 @@
<span>Be careful - it can be easy to make mistakes if you don't know what you're doing.</span>
</p>
<h3 id="entropy-notes">Entropy</h3>
<p>
<span>Entropy values should not include the BIP39 checksum. This is automatically added by the tool.</span>
</p>
<p>
<span>
Entropy values must be sourced from a
@@ -895,6 +901,7 @@
<script src="js/wordlist_chinese_traditional.js"></script>
<script src="js/wordlist_french.js"></script>
<script src="js/wordlist_italian.js"></script>
<script src="js/wordlist_korean.js"></script>
<script src="js/jsbip39.js"></script>
<script src="js/biginteger.js"></script>
<script src="js/zxcvbn.js"></script>

View File

@@ -152,6 +152,17 @@ bitcoinjs.bitcoin.networks.dogecoin = {
wif: 0x9e
};
bitcoinjs.bitcoin.networks.denarius = {
messagePrefix: '\x19Denarius Signed Message:\n',
bip32: {
public: 0x0488b21e,
private: 0x0488ade4
},
pubKeyHash: 0x1e,
scriptHash: 0x5a,
wif: 0x9e
};
bitcoinjs.bitcoin.networks.viacoin = {
messagePrefix: '\x18Viacoin Signed Message:\n',
bip32: {
@@ -328,3 +339,14 @@ bitcoinjs.bitcoin.networks.komodo = {
scriptHash: 0x55,
wif: 0xbc
};
bitcoinjs.bitcoin.networks.blackcoin = {
messagePrefix: '\x18BlackCoin Signed Message:\n',
bip32: {
public: 0x02CFBEDE,
private: 0x02CFBF60
},
pubKeyHash: 0x19,
scriptHash: 0x55,
wif: 0x99
};

View File

@@ -38,6 +38,7 @@
DOM.entropyWordCount = DOM.entropyContainer.find(".word-count");
DOM.entropyBinary = DOM.entropyContainer.find(".binary");
DOM.entropyWordIndexes = DOM.entropyContainer.find(".word-indexes");
DOM.entropyChecksum = DOM.entropyContainer.find(".checksum");
DOM.entropyMnemonicLength = DOM.entropyContainer.find(".mnemonic-length");
DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning");
DOM.phrase = $(".phrase");
@@ -1141,7 +1142,7 @@
function wordArrayToPhrase(words) {
var phrase = words.join(" ");
var language = getLanguageFromPhrase(phrase);
if (language == "japanese") {
if (language == "japanese" || language == "korean") {
phrase = words.join("\u3000");
}
return phrase;
@@ -1195,6 +1196,8 @@
DOM.phrase.val(phrase);
// Show the word indexes
showWordIndexes();
// Show the checksum
showChecksum();
}
function clearEntropyFeedback() {
@@ -1225,13 +1228,14 @@
var entropyTypeStr = getEntropyTypeStr(entropy);
var wordCount = Math.floor(numberOfBits / 32) * 3;
var bitsPerEvent = entropy.bitsPerEvent.toFixed(2);
var spacedBinaryStr = addSpacesEveryElevenBits(entropy.binaryStr);
DOM.entropyFiltered.html(entropy.cleanHtml);
DOM.entropyType.text(entropyTypeStr);
DOM.entropyCrackTime.text(timeToCrack);
DOM.entropyEventCount.text(entropy.base.ints.length);
DOM.entropyBits.text(numberOfBits);
DOM.entropyWordCount.text(wordCount);
DOM.entropyBinary.text(entropy.binaryStr);
DOM.entropyBinary.text(spacedBinaryStr);
DOM.entropyBitsPerEvent.text(bitsPerEvent);
// detect and warn of filtering
var rawNoSpaces = DOM.entropy.val().replace(/\s/g, "");
@@ -1456,6 +1460,35 @@
DOM.entropyWordIndexes.text(wordIndexesStr);
}
function showChecksum() {
var phrase = DOM.phrase.val();
var words = phraseToWordArray(phrase);
var checksumBitlength = words.length / 3;
var checksum = "";
var binaryStr = "";
var language = getLanguage();
for (var i=words.length-1; i>=0; i--) {
var word = words[i];
var wordIndex = WORDLISTS[language].indexOf(word);
var wordBinary = wordIndex.toString(2);
while (wordBinary.length < 11) {
wordBinary = "0" + wordBinary;
}
var binaryStr = wordBinary + binaryStr;
if (binaryStr.length >= checksumBitlength) {
var start = binaryStr.length - checksumBitlength;
var end = binaryStr.length;
checksum = binaryStr.substring(start, end);
// add spaces so the last group is 11 bits, not the first
checksum = checksum.split("").reverse().join("")
checksum = addSpacesEveryElevenBits(checksum);
checksum = checksum.split("").reverse().join("")
break;
}
}
DOM.entropyChecksum.text(checksum);
}
function updateCsv() {
var tableCsv = "path,address,public key,private key\n";
var rows = DOM.addresses.find("tr");
@@ -1476,6 +1509,10 @@
DOM.csv.val(tableCsv);
}
function addSpacesEveryElevenBits(binaryStr) {
return binaryStr.match(/.{1,11}/g).join(" ");
}
var networks = [
{
name: "AXE - Axe",
@@ -1494,6 +1531,14 @@
setHdCoin(145);
},
},
{
name: "BLK - BlackCoin",
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.blackcoin;
setHdCoin(10);
},
},
{
name: "BTC - Bitcoin",
segwitAvailable: true,
@@ -1550,6 +1595,14 @@
setHdCoin(1);
},
},
{
name: "DNR - Denarius",
segwitAvailable: false,
onSelect: function() {
network = bitcoinjs.bitcoin.networks.denarius;
setHdCoin(116);
},
},
{
name: "DOGE - Dogecoin",
segwitAvailable: false,
@@ -1734,7 +1787,7 @@
network = bitcoinjs.bitcoin.networks.bitcoin;
setHdCoin(144);
},
}
},
]
var clients = [

View File

@@ -149,21 +149,14 @@ var Mnemonic = function(language) {
// Set space correctly depending on the language
// see https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese
var space = " ";
if (language == "japanese") {
if (language == "japanese" || language == "korean") {
space = "\u3000"; // ideographic space
}
return words.join(space);
}
self.normalizeString = function(str) {
if (typeof str.normalize == "function") {
return str.normalize("NFKD");
}
else {
// TODO decide how to handle this in the future.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
return str;
}
return str.normalize("NFKD");
}
function byteArrayToWordArray(data) {

View File

@@ -1,3 +1,6 @@
// Polyfill for NFKD normalization
// See https://github.com/walling/unorm
(function (root) {
"use strict";

2051
src/js/wordlist_korean.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -423,6 +423,13 @@ it('Allows selection of dogecoin', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of denarius', function(done) {
var params = {
selectText: "DNR - Denarius",
firstAddress: "DFdFMVUMzU9xX88EywXvAGwjiwpxyh9vKb",
};
testNetwork(done, params);
});
it('Allows selection of shadowcash', function(done) {
var params = {
selectText: "SDC - ShadowCash",
@@ -613,6 +620,13 @@ it('Allows selection of AXE', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of BlackCoin', function(done) {
var params = {
selectText: "BLK - BlackCoin",
firstAddress: "B5MznAKwj7uQ42vDz3w4onhBXPcqhTwJ9z",
};
testNetwork(done, params);
});
// BIP39 seed is set from phrase
it('Sets the bip39 seed from the prhase', function(done) {
@@ -2908,4 +2922,36 @@ it('Can encrypt private keys using BIP38', function(done) {
});
}, bip38delay + 5000);
it('Shows the checksum for the entropy', function(done) {
driver.findElement(By.css('.use-entropy'))
.click();
driver.findElement(By.css('.entropy'))
.sendKeys("00000000000000000000000000000000");
driver.sleep(generateDelay).then(function() {
driver.findElement(By.css('.checksum'))
.getText()
.then(function(text) {
expect(text).toBe("1");
done();
});
});
});
it('Shows the checksum for the entropy with the correct groupings', function(done) {
driver.findElement(By.css('.use-entropy'))
.click();
// create a checksum of 20 bits, which spans multiple words
driver.findElement(By.css('.entropy'))
.sendKeys("F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
driver.sleep(generateDelay).then(function() {
driver.findElement(By.css('.checksum'))
.getText()
.then(function(text) {
// first group is 9 bits, second group is 11
expect(text).toBe("011010111 01110000110");
done();
});
});
});
});