hardcode english dictionary

This commit is contained in:
Michele Balistreri 2019-10-23 09:59:44 +03:00
parent 8cb43e6717
commit 3acea10750
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
2 changed files with 2059 additions and 20 deletions

View File

@ -41,28 +41,11 @@ public class Mnemonic {
}
/**
* Retrieves the official BIP39 english wordlist from GitHub.
* Returns the official BIP39 english wordlist as fetched from https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt on 23 Oct 2019.
*
* @throws IOException network error
*/
public void fetchBIP39EnglishWordlist() throws IOException {
URL remoteList = new URL("https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt");
Scanner scanner = new Scanner(remoteList.openStream());
ArrayList<String> list = new ArrayList<>();
while(scanner.hasNextLine()) {
list.add(scanner.nextLine());
}
scanner.close();
if (list.size() != WORDLIST_SIZE) {
throw new IllegalArgumentException("The list must contain exactly 2048 entries");
}
this.wordlist = new String[WORDLIST_SIZE];
list.toArray(this.wordlist);
public void fetchBIP39EnglishWordlist() {
this.wordlist = MnemonicEnglishDictionary.words;
}
/**

File diff suppressed because it is too large Load Diff