static void rc4_bench(void) { uint8_t *enckey; uint8_t match[32] = {0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD}; uint8_t cipher[32] = {0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD, 0xBE, 0xAD, 0xDE, 0xAD}; unsigned int nrprocessed = 0; clock_t startTime, endTime; enckey = calloc(16, sizeof(uint8_t)); alarm(BENCHINTERVAL); startTime = clock(); while(!finished) { rc4Match40b(enckey, cipher, match); enckey[0]++; nrprocessed++; } endTime = clock(); print_and_clean("RC4 (40, static):", nrprocessed, &startTime, &endTime); setrc4DecryptMethod(40); nrprocessed = 0; alarm(BENCHINTERVAL); startTime = clock(); while(!finished) { rc4Decrypt(enckey, cipher, 3, match); enckey[0]++; nrprocessed++; } endTime = clock(); print_and_clean("RC4 (40, no check):", nrprocessed, &startTime, &endTime); setrc4DecryptMethod(128); nrprocessed = 0; alarm(BENCHINTERVAL); startTime = clock(); while(!finished) { rc4Decrypt(enckey, cipher, 3, match); enckey[0]++; nrprocessed++; } endTime = clock(); print_and_clean("RC4 (128, no check):", nrprocessed, &startTime, &endTime); free(enckey); }
/** Checks if the rev2-password set up in encKeyWorkSpace is the correct one and return true if it is and false otherwise. */ static bool isUserPasswordRev2(struct custom_salt *cs) { uint8_t enckey[16]; md5(cs->encKeyWorkSpace, cs->ekwlen, enckey); return rc4Match40b(enckey, cs->e.u_string, pad); }
bool runCrackRev2(struct custom_salt *cs, unsigned char *currPW) { uint8_t enckey[16]; unsigned int currPWLen; currPWLen = strlen((const char *)currPW); if(currPWLen > 32) currPWLen = 32; memcpy(currPW + currPWLen, pad, 32 - currPWLen); md5(currPW, cs->ekwlen, enckey); /* Algorithm 3.4 reversed */ if (rc4Match40b(enckey, cs->e.u_string, pad)) return true; return false; }
bool runCrackRev2_o(struct custom_salt *cs, unsigned char *currPW) { uint8_t enckey[16]; unsigned int currPWLen; currPWLen = strlen((const char *)currPW); if(currPWLen > 32) currPWLen = 32; memcpy(currPW + currPWLen, pad, 32 - currPWLen); md5(currPW, 32, enckey); rc4Decrypt(enckey, cs->e.o_string, 32, currPW); md5(currPW, cs->ekwlen, enckey); if (rc4Match40b(enckey, cs->e.u_string, pad)) { memcpy(cs->password_user, cs->encKeyWorkSpace, 32); return true; } return false; }