]> git.sesse.net Git - freerainbowtables/blobdiff - Client Applications/rcracki_mt/HashAlgorithm.cpp
0.6.5 release synced from rcracki.sourceforge.net
[freerainbowtables] / Client Applications / rcracki_mt / HashAlgorithm.cpp
index caf30d63c38648b9851b674d042ad2893340a4d7..bf04682e6792e0ecbee9ef9dc89960d4308a5629 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright 2009, 2010 DaniĆ«l Niggebrugge <niggebrugge@fox-it.com>\r
  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>\r
  *\r
- * This file is part of racrcki_mt.\r
+ * This file is part of rcracki_mt.\r
  *\r
  * rcracki_mt is free software: you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
 #include <openssl/des.h>\r
 //#include <openssl/md2.h>\r
 #include <openssl/md4.h>\r
-//#include <openssl/md5.h>\r
 #include <openssl/sha.h>\r
 //#include <openssl/ripemd.h>\r
 #include "fast_md5.h"\r
 #include "md4.h"\r
 //#include "sha1.h"\r
-#ifdef _WIN32\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
        #pragma comment(lib, "libeay32.lib")\r
 #endif\r
 \r
@@ -166,7 +165,6 @@ void HashNTLMCHALL(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        des_ecb_encrypt((des_cblock*)spoofed_challange, (des_cblock*)&pHash[16], ks, DES_ENCRYPT);\r
 }\r
 \r
-\r
 void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)\r
 {\r
        char ToEncrypt[256];\r
@@ -177,11 +175,17 @@ void HashORACLE(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
        DES_key_schedule ks1,ks2;\r
        unsigned char deskey_fixed[]={ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};\r
        int i,j;\r
-\r
-       strcpy (username, "SYS");\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
+       strcpy_s(username, sizeof(username), "SYS");\r
+#else\r
+       strcpy(username, "SYS");\r
+#endif\r
        int userlen = 3;\r
-       \r
-       strupr ((char*) pPlain);\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
+       _strupr((char*) pPlain);\r
+#else\r
+       strupr((char*) pPlain);\r
+#endif\r
        memset (ToEncrypt,0,sizeof(ToEncrypt));\r
 \r
        for (i=1,j=0; j<userlen; i++,j++)\r
@@ -216,12 +220,6 @@ void HashNTLM(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
                UnicodePlain[i * 2 + 1] = 0x00;\r
        }\r
 \r
-       /*MD4_CTX ctx;\r
-       MD4_Init(&ctx);\r
-       MD4_Update(&ctx, UnicodePlain, nPlainLen * 2);\r
-       MD4_Final(pHash, &ctx);*/\r
-\r
-       //MD4(UnicodePlain, nPlainLen * 2, pHash);\r
        MD4_NEW(UnicodePlain, nPlainLen * 2, pHash);\r
 }\r
 \r
@@ -239,13 +237,7 @@ void HashMD2(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)
 \r
 void HashMD4(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)\r
 {\r
-       /*MD4_CTX ctx;\r
-       MD4_Init(&ctx);\r
-       MD4_Update(&ctx, pPlain, nPlainLen);\r
-       MD4_Final(pHash, &ctx);*/\r
-\r
        MD4_NEW(pPlain, nPlainLen, pHash);\r
-       //MD4(pPlain, nPlainLen, pHash);\r
 }\r
 \r
 void HashMD5(unsigned char* pPlain, int nPlainLen, unsigned char* pHash)\r