Package org.bitcoinj.crypto
Class MnemonicCode
- java.lang.Object
-
- org.bitcoinj.crypto.MnemonicCode
-
public class MnemonicCode extends java.lang.Object
A MnemonicCode object may be used to convert between binary seed values and lists of words per the BIP 39 specification
-
-
Field Summary
Fields Modifier and Type Field Description static long
BIP39_STANDARDISATION_TIME_SECS
UNIX time for when the BIP39 standard was finalised.static MnemonicCode
INSTANCE
-
Constructor Summary
Constructors Constructor Description MnemonicCode()
Initialise from the included word list.MnemonicCode(java.io.InputStream wordstream, java.lang.String wordListDigest)
Creates an MnemonicCode object, initializing with words read from the supplied input stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(java.util.List<java.lang.String> words)
Check to see if a mnemonic word list is valid.java.util.List<java.lang.String>
getWordList()
Gets the word list this code uses.byte[]
toEntropy(java.util.List<java.lang.String> words)
Convert mnemonic word list to original entropy value.java.util.List<java.lang.String>
toMnemonic(byte[] entropy)
Convert entropy data to mnemonic word list.static byte[]
toSeed(java.util.List<java.lang.String> words, java.lang.String passphrase)
Convert mnemonic word list to seed.
-
-
-
Field Detail
-
BIP39_STANDARDISATION_TIME_SECS
public static long BIP39_STANDARDISATION_TIME_SECS
UNIX time for when the BIP39 standard was finalised. This can be used as a default seed birthday.
-
INSTANCE
public static MnemonicCode INSTANCE
-
-
Constructor Detail
-
MnemonicCode
public MnemonicCode() throws java.io.IOException
Initialise from the included word list. Won't work on Android.- Throws:
java.io.IOException
-
MnemonicCode
public MnemonicCode(java.io.InputStream wordstream, java.lang.String wordListDigest) throws java.io.IOException, java.lang.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.- Throws:
java.io.IOException
java.lang.IllegalArgumentException
-
-
Method Detail
-
getWordList
public java.util.List<java.lang.String> getWordList()
Gets the word list this code uses.
-
toSeed
public static byte[] toSeed(java.util.List<java.lang.String> words, java.lang.String passphrase)
Convert mnemonic word list to seed.
-
toEntropy
public byte[] toEntropy(java.util.List<java.lang.String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException
Convert mnemonic word list to original entropy value.
-
toMnemonic
public java.util.List<java.lang.String> toMnemonic(byte[] entropy) throws MnemonicException.MnemonicLengthException
Convert entropy data to mnemonic word list.
-
check
public void check(java.util.List<java.lang.String> words) throws MnemonicException
Check to see if a mnemonic word list is valid.- Throws:
MnemonicException
-
-