Skip to content

Instantly share code, notes, and snippets.

@fieldAbyss
Last active July 22, 2018 16:59
Show Gist options
  • Save fieldAbyss/89d30e834b19d5f03fdd9372fd350004 to your computer and use it in GitHub Desktop.
Save fieldAbyss/89d30e834b19d5f03fdd9372fd350004 to your computer and use it in GitHub Desktop.
import org.nem.core.crypto.KeyPair;
import org.nem.core.model.Address;
import org.nem.core.model.NetworkInfos;
public class KeyGenerator {
public static void main(String[] args) {
while (true){
final KeyPair someKey = new KeyPair();
final Address anAddress = Address.fromPublicKey(
NetworkInfos.getTestNetworkInfo().getVersion(),
someKey.getPublicKey());
if(anAddress.getEncoded().contains("TEST")){
printKey(someKey, anAddress);
break;
}
}
}
private static void printKey(KeyPair someKey, Address anAddress){
System.out.println(String.format("Private Key: %s", someKey.getPrivateKey()));
System.out.println(String.format(" Public Key: %s", someKey.getPublicKey()));
System.out.println(String.format(" Address: %s", anAddress));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment