@Test public void generateSeedShouldGenerateExpectedSeeds() { byte[] actualSeed = MnemonicUtils.generateSeed(mnemonic, "TREZOR"); assertArrayEquals(seed, actualSeed); }
public static byte[] generateSeed(String mnemonic, String passphrase) { validateMnemonic(mnemonic); passphrase = passphrase == null ? "" : passphrase; String salt = String.format("mnemonic%s", passphrase); PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest()); gen.init(mnemonic.getBytes(UTF_8), salt.getBytes(UTF_8), SEED_ITERATIONS); return ((KeyParameter) gen.generateDerivedParameters(SEED_KEY_SIZE)).getKey(); }
MnemonicUtils { public static byte[] generateSeed(String mnemonic, String passphrase) { validateMnemonic(mnemonic); passphrase = passphrase == null ? "" : passphrase; String salt = String.format("mnemonic%s", passphrase); PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest()); gen.init(mnemonic.getBytes(UTF_8), salt.getBytes(UTF_8), SEED_ITERATIONS); return ((KeyParameter) gen.generateDerivedParameters(SEED_KEY_SIZE)).getKey(); } }
MnemonicUtils { public static byte[] generateSeed(String mnemonic, String passphrase) { validateMnemonic(mnemonic); passphrase = passphrase == null ? "" : passphrase; String salt = String.format("mnemonic%s", passphrase); PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest()); gen.init(mnemonic.getBytes(UTF_8), salt.getBytes(UTF_8), SEED_ITERATIONS); return ((KeyParameter) gen.generateDerivedParameters(SEED_KEY_SIZE)).getKey(); }  }
MnemonicUtils { public static byte[] generateSeed(String mnemonic, String passphrase) { validateMnemonic(mnemonic); passphrase = passphrase == null ? "" : passphrase; String salt = String.format("mnemonic%s", passphrase); PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest()); gen.init(mnemonic.getBytes(UTF_8), salt.getBytes(UTF_8), SEED_ITERATIONS); return ((KeyParameter) gen.generateDerivedParameters(SEED_KEY_SIZE)).getKey(); }  static String generateMnemonic(byte[] initialEntropy); static byte[] generateSeed(String mnemonic, String passphrase); }
MnemonicUtils { public static byte[] generateSeed(String mnemonic, String passphrase) { validateMnemonic(mnemonic); passphrase = passphrase == null ? "" : passphrase; String salt = String.format("mnemonic%s", passphrase); PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA512Digest()); gen.init(mnemonic.getBytes(UTF_8), salt.getBytes(UTF_8), SEED_ITERATIONS); return ((KeyParameter) gen.generateDerivedParameters(SEED_KEY_SIZE)).getKey(); }  static String generateMnemonic(byte[] initialEntropy); static byte[] generateSeed(String mnemonic, String passphrase);  }