/** Start cracking and does not stop until it has either been interrupted by a signal or the password either is found or wordlist or charset is exhausted */ int runCrack(char *password, struct custom_salt *cs) { bool found = false; uint8_t cpw[128]; memcpy(cpw, cs->encKeyWorkSpace, 128); if (strlen(password) < 32) strcpy((char*)cpw, password); else { strncpy((char*)cpw, password, 32); } if (!cs->workWithUser && !cs->knownPassword) { memcpy(cpw, pad, 32); if (cs->e.revision == 2) found = runCrackRev2_o(cs, cpw); else found = runCrackRev3_o(cs, cpw); } else if (cs->e.revision == 2) { if (cs->workWithUser) found = runCrackRev2(cs, cpw); else /** knownPassword */ found = runCrackRev2_of(cs, cpw); } else { if (cs->workWithUser) found = runCrackRev3(cs, cpw); else /** knownPassword */ found = runCrackRev3_of(cs, cpw); } return found; }
static void pdf_40b_bench(void) { clock_t startTime, endTime; uint8_t o_string[32] = { 0xb7, 0x81, 0xc8, 0x3d, 0x93, 0x79, 0x21, 0xcc, 0x0f, 0x3d, 0x40, 0xed, 0x18, 0xe7, 0x7f, 0x7e, 0xc0, 0x15, 0xb1, 0x63, 0xf5, 0xc8, 0x34, 0xe0, 0x54, 0x37, 0x41, 0x29, 0xe7, 0xc5, 0x1d, 0xe3 }; uint8_t u_string[32] = { 0x61, 0x74, 0x7c, 0x5c, 0xb5, 0x38, 0x3d, 0xdd, 0x6f, 0xcb, 0xb2, 0xf2, 0xfe, 0xe3, 0x34, 0x8d, 0x81, 0xe2, 0x49, 0x99, 0xc4, 0x14, 0xf6, 0x6f, 0xd0, 0x0f, 0x97, 0xe8, 0xb8, 0x29, 0xe6, 0x27 }; uint8_t fileid[16] = { 0x21, 0x76, 0x36, 0x66, 0x67, 0xf0, 0x86, 0xd5, 0x09, 0x88, 0xc3, 0xa7, 0xe9, 0x3a, 0x92, 0xca }; EncData e = { handler, o_string, u_string, fileid, true, 16, 1, 4, 40, -64, 2, 1 }; initPDFCrack(&e, NULL, true, NULL, Generative, NULL, charset, 0, 5, true); startTime = clock(); runCrackRev2(); endTime = clock(); print_and_clean("PDF (40, user):\t",getNrProcessed(),&startTime, &endTime); initPDFCrack(&e, NULL, false, NULL, Generative, NULL, charset, 0, 5, true); startTime = clock(); runCrackRev2_o(); endTime = clock(); print_and_clean("PDF (40, owner):",getNrProcessed(), &startTime, &endTime); initPDFCrack(&e, password, false, NULL, Generative, NULL, charset,0, 5,true); startTime = clock(); runCrackRev2_of(); endTime = clock(); print_and_clean("PDF (40, owner, fast):", getNrProcessed(), &startTime, &endTime); }