CrackerCore is now capable to store stats.

This commit is contained in:
Peter Boraros 2011-11-09 05:13:47 +01:00
parent 820bacc34e
commit 8b250c2645
3 changed files with 5 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
target

View file

@ -5,13 +5,13 @@ import java.util.ArrayList;
import java.util.List;
public class CrackerCore {
public static int[] select(List<long[]> stats) {
// each item of the stats must have length exactly Byte.MAX_VALUE
public int[] select(List<long[]> stats, byte[] hmac) {
double[] means = Stats.mean(stats);
ArrayList<Integer> idx = new ArrayList<Integer>();
// TODO: implement your code here **************************
// you can store your stats
for (int i = 0; i< means.length; i++) {
// for each byte test the condition
idx.add(i);

View file

@ -27,6 +27,7 @@ public class HmacCracker implements Runnable {
byte[] hmac;
int maxIterations;
int totalIterations = 0;
CrackerCore core = new CrackerCore();
public HmacCracker(OutputStream outputStream, InputStream inputStream, int iMax, byte[] signature, char[] msg) {
this.outputStream = outputStream;
@ -124,7 +125,7 @@ public class HmacCracker implements Runnable {
statsPool.add(Arrays.copyOf(stats, stats.length));
maxIt--;
}
int[] bestM = CrackerCore.select(statsPool);
int[] bestM = core.select(statsPool, hmac);
if (bestM == null) {
bin = bin*2;
System.out.print("#"); // we need to collect more stats