Skip to content

Instantly share code, notes, and snippets.

@Serphentas
Created August 27, 2016 09:21
Show Gist options
  • Save Serphentas/719e62654fc5cf36590287b052b6b163 to your computer and use it in GitHub Desktop.
Save Serphentas/719e62654fc5cf36590287b052b6b163 to your computer and use it in GitHub Desktop.
[Java] Parallel scrypt
for (int i = 0; i < 2; i++) {
new Thread(new ParallelScrypt(i)).start();
}
static class ParallelScrypt implements Runnable {
private final int iter;
public ParallelScrypt(int i) {
this.iter = i;
}
@Override
public void run() {
System.out.println(iter + " started");
long time = System.nanoTime();
try {
byte[] digest = SCrypt.generate("asdfgasdfgasdfgasdfg".getBytes("UTF-8"), GPCrypto.
randomGen(64), (int) Math.pow(2, 21), 8, 1, 32);
MessageDigest.isEqual(digest, digest);
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(test2.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(iter + " done in " + (System.nanoTime() - time) / 1e9);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment