-/*
- RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
-
- Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
-*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <string>
-#include <vector>
-#include <list>
-using namespace std;
-
-#ifdef _WIN32
- #define uint64 unsigned __int64
-#else
- #ifndef u_int64_t
- #define uint64 unsigned long long
- #else
- #define uint64 u_int64_t
- #endif
-#endif
-
-struct RainbowChainO
-{
- uint64 nIndexS;
- uint64 nIndexE;
-};
-//struct RainbowChain
-//{
-// //uint64 nChain;
-// uint64 nIndexS;
-// int nIndexE;
-// int nCheckPoint;
-//};
-
-union RainbowChain
-{
- //uint64 nChain;
- uint64 nIndexS;
- struct
- {
- unsigned short foo[3];
- unsigned short nIndexE;
- };
- //int nCheckPoint;
-};
-//struct RainbowChain
-//{
-// uint64 nIndexS : 48;
-// unsigned short nIndexE : 16;
-//};
-//struct IndexChain
-//{
-// uint64 nPrefix;
-// int nFirstChain;
-// int nChainCount;
-// //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)
-//};
-#pragma pack(1)
-union IndexChain
-{
- uint64 nPrefix; //5
- struct
- {
- unsigned char foo[5];
- int nFirstChain; //4
- unsigned short nChainCount; //2
- };
- //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)
-};
-#pragma pack()
-typedef struct
-{
- string sName;
- int nPlainLenMin;
- int nPlainLenMax;
-} tCharset;
-
-#define MAX_PLAIN_LEN 256
-#define MIN_HASH_LEN 8
-#define MAX_HASH_LEN 256
-#define MAX_SALT_LEN 256
-
-// Code comes from nmap, used for the linux implementation of kbhit()
-#ifndef _WIN32
-#include <unistd.h>
-#include <termios.h>
-#include <fcntl.h>
-
-int tty_getchar();
-void tty_done();
-void tty_init();
-void tty_flush(void);
-
-#endif
-
-
-unsigned int GetFileLen(FILE* file);
-string TrimString(string s);
-bool ReadLinesFromFile(string sPathName, vector<string>& vLine);
-bool SeperateString(string s, string sSeperator, vector<string>& vPart);
-string uint64tostr(uint64 n);
-string uint64tohexstr(uint64 n);
-string HexToStr(const unsigned char* pData, int nLen);
-unsigned int GetAvailPhysMemorySize();
-string GetApplicationPath();
-void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
-bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
-void Logo();
-bool writeResultLineToFile(string sOutputFile, string sHash, string sPlain, string sBinary);
-
-#endif
+/*\r
+ * rcracki_mt is a multithreaded implementation and fork of the original \r
+ * RainbowCrack\r
+ *\r
+ * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>\r
+ * 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 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
+ * the Free Software Foundation, version 2 of the License.\r
+ *\r
+ * rcracki_mt is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with rcracki_mt. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+\r
+#ifndef _PUBLIC_H\r
+#define _PUBLIC_H\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+#include <string>\r
+#include <vector>\r
+#include <list>\r
+\r
+#include "global.h"\r
+\r
+using namespace std;\r
+\r
+\r
+struct RainbowChainO\r
+{\r
+ uint64 nIndexS;\r
+ uint64 nIndexE;\r
+};\r
+//struct RainbowChain\r
+//{\r
+// //uint64 nChain;\r
+// uint64 nIndexS;\r
+// int nIndexE;\r
+// int nCheckPoint;\r
+//};\r
+union RainbowChain\r
+{\r
+ //uint64 nChain;\r
+ uint64 nIndexS; \r
+ struct\r
+ {\r
+ unsigned short foo[3];\r
+ unsigned short nIndexE;\r
+ };\r
+ //int nCheckPoint;\r
+};\r
+//struct RainbowChain\r
+//{\r
+// uint64 nIndexS : 48;\r
+// unsigned short nIndexE : 16;\r
+//};\r
+//struct IndexChain\r
+//{\r
+// uint64 nPrefix;\r
+// int nFirstChain;\r
+// int nChainCount;\r
+// //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)\r
+//};\r
+#pragma pack(1)\r
+union IndexChain\r
+{\r
+ uint64 nPrefix; //5\r
+ struct\r
+ {\r
+ unsigned char foo[5];\r
+ int nFirstChain; //4\r
+ unsigned short nChainCount; //2\r
+ };\r
+ //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)\r
+};\r
+#pragma pack()\r
+typedef struct\r
+{\r
+ string sName;\r
+ int nPlainLenMin;\r
+ int nPlainLenMax;\r
+} tCharset;\r
+\r
+#define MAX_PLAIN_LEN 256\r
+#define MIN_HASH_LEN 8\r
+#define MAX_HASH_LEN 256\r
+#define MAX_SALT_LEN 256\r
+\r
+// XXX nmap is GPL2, will check newer releases regarding license\r
+// Code comes from nmap, used for the linux implementation of kbhit()\r
+#ifndef _WIN32\r
+#include <unistd.h>\r
+#include <termios.h>\r
+#include <fcntl.h>\r
+\r
+int tty_getchar();\r
+void tty_done();\r
+void tty_init();\r
+void tty_flush(void);\r
+// end nmap code\r
+#endif\r
+\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
+ int gettimeofday( struct timeval *tv, struct timezone *tz );\r
+#endif\r
+\r
+#if !defined(_WIN32) || defined(__GNUC__)\r
+ #include <sys/time.h>\r
+#endif\r
+\r
+timeval sub_timeofday( timeval tv2, timeval tv );\r
+\r
+long GetFileLen(FILE* file);\r
+string TrimString(string s);\r
+bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
+bool ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
+bool SeperateString(string s, string sSeperator, vector<string>& vPart);\r
+string uint64tostr(uint64 n);\r
+string uint64tohexstr(uint64 n);\r
+string HexToStr(const unsigned char* pData, int nLen);\r
+unsigned long GetAvailPhysMemorySize();\r
+string GetApplicationPath();\r
+void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);\r
+bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);\r
+void Logo();\r
+bool writeResultLineToFile(string sOutputFile, string sHash, string sPlain, string sBinary);\r
+\r
+#endif\r