]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/Public.h
CrackEngine.h pulls in ChainWalkSet.h through transitive dependencies, so RainbowCrac...
[freerainbowtables] / Client Applications / rcracki_mt / Public.h
1 /*\r
2  * rcracki_mt is a multithreaded implementation and fork of the original \r
3  * RainbowCrack\r
4  *\r
5  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>\r
6  * Copyright 2009, 2010 DaniĆ«l Niggebrugge <niggebrugge@fox-it.com>\r
7  * Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>\r
8  *\r
9  * This file is part of rcracki_mt.\r
10  *\r
11  * rcracki_mt is free software: you can redistribute it and/or modify\r
12  * it under the terms of the GNU General Public License as published by\r
13  * the Free Software Foundation, version 2 of the License.\r
14  *\r
15  * rcracki_mt is distributed in the hope that it will be useful,\r
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18  * GNU General Public License for more details.\r
19  *\r
20  * You should have received a copy of the GNU General Public License\r
21  * along with rcracki_mt.  If not, see <http://www.gnu.org/licenses/>.\r
22  */\r
23 \r
24 #ifndef _PUBLIC_H\r
25 #define _PUBLIC_H\r
26 \r
27 #include <stdio.h>\r
28 #include <stdlib.h>\r
29 #include <string.h>\r
30 \r
31 #include <algorithm>\r
32 #include <string>\r
33 #include <vector>\r
34 #include <list>\r
35 #include <map>\r
36 #include <utility>\r
37 \r
38 #include "global.h"\r
39 \r
40 using namespace std;\r
41 \r
42 struct RainbowChainO\r
43 {\r
44         uint64 nIndexS;\r
45         uint64 nIndexE;\r
46 };\r
47 //struct RainbowChain\r
48 //{\r
49 //      //uint64 nChain;\r
50 //      uint64 nIndexS;\r
51 //      int nIndexE;\r
52 //      int nCheckPoint;\r
53 //};\r
54 union RainbowChain\r
55 {\r
56         //uint64 nChain;\r
57         uint64 nIndexS; \r
58         struct\r
59         {\r
60                 unsigned short foo[3];\r
61                 unsigned short nIndexE;\r
62         };\r
63         //int nCheckPoint;\r
64 };\r
65 //struct RainbowChain\r
66 //{\r
67 //      uint64 nIndexS : 48;\r
68 //      unsigned short nIndexE : 16;\r
69 //};\r
70 //struct IndexChain\r
71 //{\r
72 //      uint64 nPrefix;\r
73 //      int nFirstChain;\r
74 //      int nChainCount;\r
75 //      //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)\r
76 //};\r
77 #pragma pack(1)\r
78 union IndexChain\r
79 {\r
80         uint64 nPrefix; //5\r
81         struct\r
82         {\r
83                 unsigned char foo[5];\r
84                 int nFirstChain; //4\r
85                 unsigned short nChainCount; //2\r
86         };\r
87         //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)\r
88 };\r
89 #pragma pack()\r
90 typedef struct\r
91 {\r
92         string sName;\r
93         int nPlainLenMin;\r
94         int nPlainLenMax;\r
95 } tCharset;\r
96 \r
97 #define MAX_PLAIN_LEN 256\r
98 #define MIN_HASH_LEN  8\r
99 #define MAX_HASH_LEN  256\r
100 #define MAX_SALT_LEN  256\r
101 \r
102 // XXX nmap is GPL2, will check newer releases regarding license\r
103 // Code comes from nmap, used for the linux implementation of kbhit()\r
104 #ifndef _WIN32\r
105 #include <unistd.h>\r
106 #include <termios.h>\r
107 #include <fcntl.h>\r
108 \r
109 int tty_getchar();\r
110 void tty_done();\r
111 void tty_init();\r
112 void tty_flush(void);\r
113 // end nmap code\r
114 \r
115 #endif\r
116 \r
117 #if defined(_WIN32) && !defined(__GNUC__)\r
118         int gettimeofday( struct timeval *tv, struct timezone *tz );\r
119 #else\r
120         #include <sys/time.h>\r
121 #endif\r
122 \r
123 timeval sub_timeofday( timeval tv2, timeval tv );\r
124 \r
125 long GetFileLen(FILE* file);\r
126 string TrimString(string s);\r
127 bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
128 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
129 bool SeparateString(string s, string sSeperator, vector<string>& vPart);\r
130 string uint64tostr(uint64 n);\r
131 string uint64tohexstr(uint64 n);\r
132 string HexToStr(const unsigned char* pData, int nLen);\r
133 unsigned long GetAvailPhysMemorySize();\r
134 string GetApplicationPath();\r
135 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);\r
136 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);\r
137 void Logo();\r
138 bool writeResultLineToFile(string sOutputFile, string sHash, string sPlain, string sBinary);\r
139 \r
140 #endif\r