Skip to content

Commit

Permalink
v 0.5.11, improvement for END
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelGorny committed Jun 8, 2022
1 parent c8a11b5 commit b359c7e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
8 changes: 8 additions & 0 deletions examples/example_END.conf3
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#this solver tries to fnd WIF with missing characters at the end
#1st line: type of work
END
#target: L5EZftvrYaSudiozVRzTqLcHLNDoVn7H5HSfM9BAN6tMJX8oTWz6
#2nd line: WIF with missing end, 10 characters missing
L5EZftvrYaSudiozVRzTqLcHLNDoVn7H5HSfM9BAN6
#3rd end: expected address, if you know one
1EUXSxuUVy2PC5enGXR1a3yxbEjNWMHuem
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.pawelgorny</groupId>
<artifactId>wifSolver</artifactId>
<version>0.5.10</version>
<version>0.5.11</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/pawelgorny/wifsolver/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Configuration {
private final static NetworkParameters NETWORK_PARAMETERS = MainNetParams.get();
private final static int STATUS_PERIOD = 60 * 1000; //1 minute
private final static int CHECKSUM_CHARS = 5;
private final static int CHECKSUM_CHARS_COMPRESSED = 6;

private Boolean isP2SH;
private final String targetAddress;
Expand Down Expand Up @@ -51,7 +52,10 @@ public Configuration(String targetAddress, String wif, String wifStatus, WORK wo
}

public static int getChecksumChars() {
return CHECKSUM_CHARS;
return getChecksumChars(false);
}
public static int getChecksumChars(boolean compressed) {
return compressed?CHECKSUM_CHARS_COMPRESSED:CHECKSUM_CHARS;
}

public static NetworkParameters getNetworkParameters() {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/pawelgorny/wifsolver/WorkerEnd.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ private static void increment58(int[] array) {

protected void run() throws InterruptedException {
String wif = configuration.getWif();

boolean compressed = false;
int len = 51;
if (wif.startsWith("L")||wif.startsWith("K")){
compressed = true;
len = Configuration.COMPRESSED_WIF_LENGTH;
System.out.println("Looking for compressed address");
}
Expand All @@ -50,11 +51,11 @@ protected void run() throws InterruptedException {
System.out.println("nothing to do?");
System.exit(0);
}
if (missing <= Configuration.getChecksumChars()) {
if (missing <= Configuration.getChecksumChars(compressed)) {
System.out.println("Missing less than " + Configuration.getChecksumChars() + " last characters, quick check launched");
checksumCheck(missing, wif, len, null, "");
} else {
if (missing - Configuration.getChecksumChars() > 3) {
if (missing - Configuration.getChecksumChars(compressed) >= 3) {
setThreads();
System.out.println("Using " + THREADS + " threads");
}
Expand All @@ -67,9 +68,10 @@ protected void run() throws InterruptedException {
final boolean reporter = t == 0;
final int tNr = t;
final int expectedLength = len;
final boolean _compressed = compressed;
executorService.submit(() -> {
try {
int[] arr = new int[missing - Configuration.getChecksumChars()];
int[] arr = new int[missing - Configuration.getChecksumChars(_compressed)];
arr[0] = tNr * step;
final int arrLimit = Math.min(58, (tNr + 1) * step);
StringBuilder stringBuilderThread = new StringBuilder(expectedLength);
Expand All @@ -84,7 +86,7 @@ protected void run() throws InterruptedException {
for (int anArr : arr) {
stringBuilderThread.append(Base58.ALPHABET[anArr]);
}
lastTested[tNr] = checksumCheck(Configuration.getChecksumChars(), stringBuilderThread.toString(), expectedLength, configuration.getAddress(), lastTested[tNr]);
lastTested[tNr] = checksumCheck(Configuration.getChecksumChars(_compressed), stringBuilderThread.toString(), expectedLength, configuration.getAddress(), lastTested[tNr]);
if (found) {
break;
}
Expand Down Expand Up @@ -158,6 +160,5 @@ private void setThreads() {
procs = THREADS_MIN;
}
THREADS = Math.min(procs, 29);
THREADS = 1;
}
}

0 comments on commit b359c7e

Please sign in to comment.