Skip to content

Commit

Permalink
Brute force up to 5 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Jun 5, 2011
1 parent 422f3df commit 66fb14e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions brute_force.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,31 @@ int main(int argc, char ** argv) {
oox::core::BinaryCodec_XOR x(oox::core::BinaryCodec_XOR::CODEC_EXCEL);
unsigned char t[9] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };

// BRUTE FORCE exactly 4 chars
// BRUTE FORCE up to 5 chars
for(unsigned char i=32; i < 127; ++i) {
t[0] = i;
std::cout << (short)i << std::endl;
for(unsigned char j=32; j < 127; ++j) {
t[1] = j;
for(unsigned char k=32; k < 127; ++k) {
t[2] = k;
for(unsigned char l=32; l < 127; ++l) {
t[3] = l;
if (nHash == x.getHash(t, 16)) {
x.initKey(t);
bool res = x.verifyKey(nKey, nHash);
if (res) {
std::cout << t << " " << res << std::endl;
return EXIT_SUCCESS;
for(unsigned char j=32; j < 128; ++j) {
std::cout << " " << (short)j << std::endl;
for(unsigned char k=32; k < 128; ++k) {
for(unsigned char l=32; l < 128; ++l) {
for(unsigned char m=32; m < 128; ++m) {
if (nHash == x.getHash(t, 16)) {
x.initKey(t);
bool res = x.verifyKey(nKey, nHash);
if (res) {
std::cout << t << " " << res << std::endl;
return EXIT_SUCCESS;
}
}
t[0] = m;
}
t[1] = l;
}
t[2] = k;
}
t[3] = j;
}
t[4] = i;
}

return EXIT_FAILURE;
Expand Down

0 comments on commit 66fb14e

Please sign in to comment.