@Override public int compare(final DeterministicKey k1, final DeterministicKey k2) { int key1Num = k1.getChildNumber().num(); int key2Num = k2.getChildNumber().num(); // In reality Integer.compare(key2Num, key1Num) but is not available on older devices return (key2Num < key1Num) ? -1 : ((key2Num == key1Num) ? 0 : 1); } };
/** * Derives a child at the given index using hardened derivation. Note: <code>index</code> is * not the "i" value. If you want the softened derivation, then use instead * <code>HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, false))</code>. */ public DeterministicKey derive(int child) { return HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, true)); }
private DeterministicKey deriveChild(DeterministicKey parent, ChildNumber createChildNumber) { DeterministicKey childKey = HDKeyDerivation.deriveChildKey(parent, createChildNumber); putKey(childKey); return childKey; }
/** * Returns the path of this key as a human readable string starting with M to indicate the master key. */ public String getPathAsString() { return HDUtils.formatPath(getPath()); }
@Override public int compare(ECKey k1, ECKey k2) { ChildNumber cn1 = ((DeterministicKey) k1).getChildNumber(); ChildNumber cn2 = ((DeterministicKey) k2).getChildNumber(); return cn1.compareTo(cn2); } };
/** * Constructs a new hierarchy rooted at the given key. Note that this does not have to be the top of the tree. * You can construct a DeterministicHierarchy for a subtree of a larger tree that you may not own. */ public DeterministicHierarchy(DeterministicKey rootKey) { putKey(rootKey); rootPath = rootKey.getPath(); }
/** * Derives a child at the given index using hardened derivation. Note: {@code index} is * not the "i" value. If you want the softened derivation, then use instead * {@code HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, false))}. */ public DeterministicKey derive(int child) { return HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, true)); }
private DeterministicKey deriveChild(DeterministicKey parent, ChildNumber createChildNumber) { DeterministicKey childKey = HDKeyDerivation.deriveChildKey(parent, createChildNumber); putKey(childKey); return childKey; }
/** * Returns the path of this key as a human readable string starting with M to indicate the master key. */ public String getPathAsString() { return HDUtils.formatPath(getPath()); }
@Override public int compare(ECKey k1, ECKey k2) { ChildNumber cn1 = ((DeterministicKey) k1).getChildNumber(); ChildNumber cn2 = ((DeterministicKey) k2).getChildNumber(); return cn1.compareTo(cn2); } };
/** * Constructs a new hierarchy rooted at the given key. Note that this does not have to be the top of the tree. * You can construct a DeterministicHierarchy for a subtree of a larger tree that you may not own. */ public DeterministicHierarchy(DeterministicKey rootKey) { putKey(rootKey); rootPath = rootKey.getPath(); }
/** * Derives a key given the "extended" child number, ie. the 0x80000000 bit of the value that you * pass for <code>childNumber</code> will determine whether to use hardened derivation or not. * Consider whether your code would benefit from the clarity of the equivalent, but explicit, form * of this method that takes a <code>ChildNumber</code> rather than an <code>int</code>, for example: * <code>deriveChildKey(parent, new ChildNumber(childNumber, true))</code> * where the value of the hardened bit of <code>childNumber</code> is zero. */ public static DeterministicKey deriveChildKey(DeterministicKey parent, int childNumber) { return deriveChildKey(parent, new ChildNumber(childNumber)); }
private DeterministicKey deriveChild(DeterministicKey parent, ChildNumber createChildNumber) { DeterministicKey childKey = HDKeyDerivation.deriveChildKey(parent, createChildNumber); putKey(childKey); return childKey; }
/** * Returns the path of this key as a human readable string starting with M to indicate the master key. */ public String getPathAsString() { return HDUtils.formatPath(getPath()); }
@Override public int compare(ECKey k1, ECKey k2) { ChildNumber cn1 = ((DeterministicKey) k1).getChildNumber(); ChildNumber cn2 = ((DeterministicKey) k2).getChildNumber(); return cn1.compareTo(cn2); } };
/** * Constructs a new hierarchy rooted at the given key. Note that this does not have to be the top of the tree. * You can construct a DeterministicHierarchy for a subtree of a larger tree that you may not own. */ public DeterministicHierarchy(DeterministicKey rootKey) { putKey(rootKey); rootPath = rootKey.getPath(); }
/** * Derives a key given the "extended" child number, ie. the 0x80000000 bit of the value that you * pass for <code>childNumber</code> will determine whether to use hardened derivation or not. * Consider whether your code would benefit from the clarity of the equivalent, but explicit, form * of this method that takes a <code>ChildNumber</code> rather than an <code>int</code>, for example: * <code>deriveChildKey(parent, new ChildNumber(childNumber, true))</code> * where the value of the hardened bit of <code>childNumber</code> is zero. */ public static DeterministicKey deriveChildKey(DeterministicKey parent, int childNumber) { return deriveChildKey(parent, new ChildNumber(childNumber)); }
private DeterministicKey deriveChild(DeterministicKey parent, ChildNumber createChildNumber) { DeterministicKey childKey = HDKeyDerivation.deriveChildKey(parent, createChildNumber); putKey(childKey); return childKey; }
/** * Derives a child at the given index using hardened derivation. Note: <code>index</code> is * not the "i" value. If you want the softened derivation, then use instead * <code>HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, false))</code>. */ public DeterministicKey derive(int child) { return HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, true)); }
/** * Derives a child at the given index using hardened derivation. Note: <code>index</code> is * not the "i" value. If you want the softened derivation, then use instead * <code>HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, false))</code>. */ public DeterministicKey derive(int child) { return HDKeyDerivation.deriveChildKey(this, new ChildNumber(child, true)); }