@Test public void testChild() throws NoSuchAlgorithmException, SignatureException, InvalidKeyException { String hxprv = "10fdbc41a4d3b8e5a0f50dd3905c1660e7476d4db3dbd9454fa4347500a633531c487e8174ffc0cfa76c3be6833111a9b8cd94446e37a76ee18bb21a7d6ea66b"; String[] hpaths = {"010400000000000000", "0100000000000000"}; byte[] childXprv = NonHardenedChild.child(Hex.decode(hxprv), hpaths); }
public static byte[] child(byte[] xprv, String[] hpaths) throws NoSuchAlgorithmException, InvalidKeyException { byte[][] paths = new byte[][]{ Hex.decode(hpaths[0]), Hex.decode(hpaths[1]) }; byte[] res = xprv; for (int i = 0; i < hpaths.length; i++) { byte[] xpub = DeriveXpub.deriveXpub(res); res = NonHardenedChild.nhChild(paths[i], res, xpub); } return res; }
NonHardenedChild { public static byte[] child(byte[] xprv, String[] hpaths) throws NoSuchAlgorithmException, InvalidKeyException { byte[][] paths = new byte[][]{ Hex.decode(hpaths[0]), Hex.decode(hpaths[1]) }; byte[] res = xprv; for (int i = 0; i < hpaths.length; i++) { byte[] xpub = DeriveXpub.deriveXpub(res); res = NonHardenedChild.nhChild(paths[i], res, xpub); } return res; } }
NonHardenedChild { public static byte[] child(byte[] xprv, String[] hpaths) throws NoSuchAlgorithmException, InvalidKeyException { byte[][] paths = new byte[][]{ Hex.decode(hpaths[0]), Hex.decode(hpaths[1]) }; byte[] res = xprv; for (int i = 0; i < hpaths.length; i++) { byte[] xpub = DeriveXpub.deriveXpub(res); res = NonHardenedChild.nhChild(paths[i], res, xpub); } return res; }  }
NonHardenedChild { public static byte[] child(byte[] xprv, String[] hpaths) throws NoSuchAlgorithmException, InvalidKeyException { byte[][] paths = new byte[][]{ Hex.decode(hpaths[0]), Hex.decode(hpaths[1]) }; byte[] res = xprv; for (int i = 0; i < hpaths.length; i++) { byte[] xpub = DeriveXpub.deriveXpub(res); res = NonHardenedChild.nhChild(paths[i], res, xpub); } return res; }  static byte[] nhChild(byte[] path, byte[] xprv, byte[] xpub); static byte[] child(byte[] xprv, String[] hpaths); }
NonHardenedChild { public static byte[] child(byte[] xprv, String[] hpaths) throws NoSuchAlgorithmException, InvalidKeyException { byte[][] paths = new byte[][]{ Hex.decode(hpaths[0]), Hex.decode(hpaths[1]) }; byte[] res = xprv; for (int i = 0; i < hpaths.length; i++) { byte[] xpub = DeriveXpub.deriveXpub(res); res = NonHardenedChild.nhChild(paths[i], res, xpub); } return res; }  static byte[] nhChild(byte[] path, byte[] xprv, byte[] xpub); static byte[] child(byte[] xprv, String[] hpaths);  }