Package org.bitcoinj.crypto
Class MnemonicCode
java.lang.Object
org.bitcoinj.crypto.MnemonicCode
A MnemonicCode object may be used to convert between binary seed values and
 lists of words per the BIP 39
 specification
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InstantUNIX time for when the BIP39 standard was finalised.static final intDeprecated.static MnemonicCode - 
Constructor Summary
ConstructorsConstructorDescriptionInitialise from the included word list.MnemonicCode(InputStream wordstream, String wordListDigest) Creates an MnemonicCode object, initializing with words read from the supplied input stream. - 
Method Summary
Modifier and TypeMethodDescriptionvoidCheck to see if a mnemonic word list is valid.Gets the word list this code uses.byte[]Convert mnemonic word list to original entropy value.toMnemonic(byte[] entropy) Convert entropy data to mnemonic word list.static byte[]Convert mnemonic word list to seed. 
- 
Field Details
- 
BIP39_STANDARDISATION_TIME
UNIX time for when the BIP39 standard was finalised. This can be used as a default seed birthday. - 
BIP39_STANDARDISATION_TIME_SECS
Deprecated. - 
INSTANCE
 
 - 
 - 
Constructor Details
- 
MnemonicCode
Initialise from the included word list. Won't work on Android.- Throws:
 IOException
 - 
MnemonicCode
public MnemonicCode(InputStream wordstream, String wordListDigest) throws IOException, IllegalArgumentException Creates an MnemonicCode object, initializing with words read from the supplied input stream. If a wordListDigest is supplied the digest of the words will be checked.- Parameters:
 wordstream- input stream of 2048 line-seperated wordswordListDigest- hex-encoded Sha256 digest to check against- Throws:
 IOException- if there was a problem reading the steamIllegalArgumentException- if list size is not 2048 or digest mismatch
 
 - 
 - 
Method Details
- 
getWordList
Gets the word list this code uses.- Returns:
 - unmodifiable word list
 
 - 
toSeed
Convert mnemonic word list to seed. - 
toEntropy
public byte[] toEntropy(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException Convert mnemonic word list to original entropy value. - 
toMnemonic
Convert entropy data to mnemonic word list.- Parameters:
 entropy- entropy bits, length must be a multiple of 32 bits
 - 
check
Check to see if a mnemonic word list is valid.- Throws:
 MnemonicException
 
 - 
 
BIP39_STANDARDISATION_TIME