Skip to content

Instantly share code, notes, and snippets.

@devrandom
devrandom / HDUtil.java
Created December 5, 2014 18:13 — forked from anonymous/HDUtil.java
Parse Bitcoin extended keys
public class HDUtil {
private static final byte[] xprv = new byte[]{0x04, (byte) 0x88, (byte) 0xAD, (byte) 0xE4};
private static final byte[] xpub = new byte[]{0x04, (byte) 0x88, (byte) 0xB2, (byte) 0x1E};
private static final byte[] tprv = new byte[]{0x04, (byte) 0x35, (byte) 0x83, (byte) 0x94};
private static final byte[] tpub = new byte[]{0x04, (byte) 0x35, (byte) 0x87, (byte) 0xCF};
public static DeterministicKey parseDeterministicKey(String serialized) throws AddressFormatException {
byte[] data = Base58.decodeChecked(serialized);
if (data.length != 78) {