public static MasterPrivateKey create(byte[] seed) throws HyperLedgerException {
  try {
    Mac mac=Mac.getInstance("HmacSHA512","BC");
    SecretKey seedkey=new SecretKeySpec(BITCOIN_SEED,"HmacSHA512");
    mac.init(seedkey);
    byte[] lr=mac.doFinal(seed);
    byte[] l=Arrays.copyOfRange(lr,0,32);
    byte[] r=Arrays.copyOfRange(lr,32,64);
    BigInteger m=new BigInteger(1,l);
    if (m.compareTo(curve.getN()) >= 0 || m.compareTo(BigInteger.ZERO) == 0) {
      throw new HyperLedgerException("This is rather unlikely, but it did just happen");
    }
    PrivateKey keyPair=new PrivateKey(m,true);
    return new MasterPrivateKey(keyPair,r,0,0,0);
  }
 catch (  NoSuchAlgorithmException|InvalidKeyException|NoSuchProviderException e) {
    throw new HyperLedgerException(e);
  }
}

public static MasterPrivateKey create ( byte [ ] seed ) throws HyperLedgerException { try { Mac mac = Mac . getInstance ( "HmacSHA512" , "BC" ) ; SecretKey seedkey = new SecretKeySpec ( BITCOIN_SEED , "HmacSHA512" ) ; mac . init ( seedkey ) ; byte [ ] lr = mac . doFinal ( seed ) ; byte [ ] l = Arrays . copyOfRange ( lr , 0 , 32 ) ; byte [ ] r = Arrays . copyOfRange ( lr , 32 , 64 ) ; BigInteger m = new BigInteger ( 1 , l ) ; if ( m . compareTo ( curve . getN ( ) ) >= 0 || m . compareTo ( BigInteger . ZERO ) == 0 ) { throw new HyperLedgerException ( "This is rather unlikely, but it did just happen" ) ; } PrivateKey keyPair = new PrivateKey ( m , true ) ; return new MasterPrivateKey ( keyPair , r , 0 , 0 , 0 ) ; } catch ( NoSuchAlgorithmException | InvalidKeyException | NoSuchProviderException e ) { throw new HyperLedgerException ( e ) ; } }
create a masterprivatekey from a plain text seed . the seed is stretched / resized to 64 bytes with hmacsha512
