mirror of
https://github.com/brmlab/timingattack.git
synced 2025-06-07 16:44:00 +02:00
CrackerCore is now capable to store stats.
This commit is contained in:
parent
820bacc34e
commit
8b250c2645
3 changed files with 5 additions and 3 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
target
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue