Skip to content

Instantly share code, notes, and snippets.

@maqiv
Created March 13, 2016 15:06
Show Gist options
  • Save maqiv/81dc9f7cb6ffc2c91cd5 to your computer and use it in GitHub Desktop.
Save maqiv/81dc9f7cb6ffc2c91cd5 to your computer and use it in GitHub Desktop.
it-sicherheit lab02 determineKey()
public int[] determineKey(int keylength, int depth) throws IOException {
totalNumberOfKeysToTest = getNumberOfCandidateKeys(keylength, depth);
numberOfKeysTested = 0;
ByteFrequencyTable[] frequencyTable = getFrequencyTableForKeyLength(keylength);
int[] key = null;
//TODO
KeyGenerator gen = new KeyGenerator(frequencyTable, depth, 0);
while ((key = gen.getNextCandidateKey()) != null) {
if(encryptedZipFile.tryDecryption(key)) {
return key;
}
}
return key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment