File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -24,17 +24,17 @@ int main(int argc, char** argv) {
2424
2525
2626string 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 ());
27+ unsigned char digest[16 ]; // allocate 16 bytes for result, or "digest"
28+ char * to_hash = new char (input.length ()); // allocate space for input
29+ strcpy (to_hash, input.c_str ()); // copy input into to_hash
3030
31- MD5 ((unsigned char *)(to_hash), strlen (to_hash), (unsigned char *)(digest));
32- return string ((char *)&digest, 16 );
31+ MD5 ((unsigned char *)(to_hash), strlen (to_hash), (unsigned char *)(digest)); // compute the md5
32+ return string ((char *)&digest, 16 ); // convert into a string
3333}
3434
3535// compute alternate sum
3636string compute_altsum (string salt, string passwd) {
37- 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
37+ return compute_primitive_md5 (passwd. append ( salt). append (passwd)); // maybe just not make this a function?
3838}
3939
4040
You can’t perform that action at this time.
0 commit comments