Skip to content

Commit ddfb119

Browse files
finished primitive md5 function.
also tested. seems to work.
1 parent 62d95d5 commit ddfb119

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crack.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
#include <openssl/md5.h>
12
#include <cstdlib>
23
#include <bitset>
34
#include <cstring>
45
#include <string>
6+
#include <iostream>
57

68
using namespace std;
79

@@ -10,15 +12,26 @@ string compute_intermsum(string psswd, string magic, string salt, string altsum)
1012
string interm_1000(string psswd, string salt, string intermsum); // extends to intermsum to intermediate_1000 sum
1113
bitset<128> str_to_bin(string tmp); // for the final printing
1214
string md5_crypthash(string passwd, string salt, string magic, string finalsum);
15+
string compute_primitive_md5(string input); //return the "primitive" md5 hash of a string
1316

1417
int main(int argc, char** argv) {
1518
// compute alternate sum
1619
// compute intermediate sum
1720
// remaining calculations to extend intermsum to interm_1000
21+
// rearrange/hash the bytes of the interm_1000
1822
return 0;
1923
}
2024

2125

26+
string compute_primitive_md5(string input) {
27+
unsigned char digest[16];
28+
char* to_hash = new char(input.length());
29+
strcpy(to_hash, input.c_str());
30+
31+
MD5((unsigned char*)(to_hash), strlen(to_hash), (unsigned char*)(digest));
32+
return string((char*)&digest, 16);
33+
}
34+
2235
// compute alternate sum
2336
string compute_altsum(string salt, string passwd) {
2437
return "altsum"; // replace altsum with md5(psswd + salt + psswd); TODO: look into the library Alex sent and get rid of the overhead of this function

0 commit comments

Comments
 (0)