Skip to content

Commit

Permalink
0.3 - minor patch for JUMP worker
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelGorny committed Aug 27, 2020
1 parent e3fb940 commit db192b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions 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.2</version>
<version>0.3</version>
<packaging>jar</packaging>

<dependencies>
Expand All @@ -18,7 +18,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
<version>25.0-jre</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/pawelgorny/wifsolver/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ void run() throws InterruptedException {
System.out.println("--- Work finished ---");
System.out.println("Worker '"+configuration.getWork().name()+"' ended, "+WIF_RESULTS.size()+" result(s) "+(new Date()));
WIF_RESULTS.forEach(System.out::println);
resultToFile();
if (!WIF_RESULTS.isEmpty()) {
resultToFile();
}
sendEmail("Worker '"+configuration.getWork().name()+"' ended, "+WIF_RESULTS.size()+" result(s)", String.join("\n", WIF_RESULTS));
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/pawelgorny/wifsolver/WorkerJump.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
class WorkerJump extends Worker {

private final Configuration configuration;
private final long ITERATIONS_PER_THREAD = 2_000_000L;
private BigInteger LIMIT;
private BigInteger DIFF;
private String STARTER;
private String RESULT = null;
private final long ITERATIONS_PER_THREAD = 2_000_000L;


public WorkerJump(Configuration configuration) {
Expand All @@ -37,18 +37,18 @@ protected void run() throws InterruptedException {
byte[] bytes = Base58.decode(STARTER);
String hex = bytesToHex(bytes);
BigInteger priv = new BigInteger(hex, 16);
final String suffix = hex.substring(hex.length() - 7);
final String suffix = hex.substring(hex.length() - 8);
long count = 0;
long jumpNb = 0;
long falseJump =0;
long firstJump =0;
Set<Long> jumpLength = new HashSet<>();
Set<Long> jumpLength = new HashSet<>(2);
while(jumpNb<10) {
do {
count++;
priv = priv.add(DIFF);
bytes = hexStringToByteArray(priv.toString(16));
} while (count<8192 && (bytes[33] != 1 && !priv.toString(16).endsWith(suffix)));
} while (count < 8192 && (bytes[33] != 1 || !priv.toString(16).endsWith(suffix)));
if (count==8192){
System.out.println(":-( Skipping " + STARTER + ", cannot find the proper ending");
return;
Expand Down

0 comments on commit db192b1

Please sign in to comment.