Created
August 27, 2016 09:21
-
-
Save Serphentas/719e62654fc5cf36590287b052b6b163 to your computer and use it in GitHub Desktop.
[Java] Parallel scrypt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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