]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/Public.h
(C)
[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 <string>\r
32 #include <vector>\r
33 #include <list>\r
34 \r
35 #include "global.h"\r
36 \r
37 using namespace std;\r
38 \r
39 struct RainbowChainO\r
40 {\r
41         uint64 nIndexS;\r
42         uint64 nIndexE;\r
43 };\r
44 //struct RainbowChain\r
45 //{\r
46 //      //uint64 nChain;\r
47 //      uint64 nIndexS;\r
48 //      int nIndexE;\r
49 //      int nCheckPoint;\r
50 //};\r
51 union RainbowChain\r
52 {\r
53         //uint64 nChain;\r
54         uint64 nIndexS; \r
55         struct\r
56         {\r
57                 unsigned short foo[3];\r
58                 unsigned short nIndexE;\r
59         };\r
60         //int nCheckPoint;\r
61 };\r
62 //struct RainbowChain\r
63 //{\r
64 //      uint64 nIndexS : 48;\r
65 //      unsigned short nIndexE : 16;\r
66 //};\r
67 //struct IndexChain\r
68 //{\r
69 //      uint64 nPrefix;\r
70 //      int nFirstChain;\r
71 //      int nChainCount;\r
72 //      //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)\r
73 //};\r
74 #pragma pack(1)\r
75 union IndexChain\r
76 {\r
77         uint64 nPrefix; //5\r
78         struct\r
79         {\r
80                 unsigned char foo[5];\r
81                 int nFirstChain; //4\r
82                 unsigned short nChainCount; //2\r
83         };\r
84         //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)\r
85 };\r
86 #pragma pack()\r
87 typedef struct\r
88 {\r
89         string sName;\r
90         int nPlainLenMin;\r
91         int nPlainLenMax;\r
92 } tCharset;\r
93 \r
94 #define MAX_PLAIN_LEN 256\r
95 #define MIN_HASH_LEN  8\r
96 #define MAX_HASH_LEN  256\r
97 #define MAX_SALT_LEN  256\r
98 \r
99 // XXX nmap is GPL2, will check newer releases regarding license\r
100 // Code comes from nmap, used for the linux implementation of kbhit()\r
101 #ifndef _WIN32\r
102 #include <unistd.h>\r
103 #include <termios.h>\r
104 #include <fcntl.h>\r
105 \r
106 int tty_getchar();\r
107 void tty_done();\r
108 void tty_init();\r
109 void tty_flush(void);\r
110 // end nmap code\r
111 \r
112 #endif\r
113 \r
114 #if defined(_WIN32) && !defined(__GNUC__)\r
115         int gettimeofday( struct timeval *tv, struct timezone *tz );\r
116 #else\r
117         #include <sys/time.h>\r
118 #endif\r
119 \r
120 timeval sub_timeofday( timeval tv2, timeval tv );\r
121 \r
122 long GetFileLen(FILE* file);\r
123 string TrimString(string s);\r
124 bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
125 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);\r
126 bool SeperateString(string s, string sSeperator, vector<string>& vPart);\r
127 string uint64tostr(uint64 n);\r
128 string uint64tohexstr(uint64 n);\r
129 string HexToStr(const unsigned char* pData, int nLen);\r
130 unsigned long GetAvailPhysMemorySize();\r
131 string GetApplicationPath();\r
132 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);\r
133 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);\r
134 void Logo();\r
135 bool writeResultLineToFile(string sOutputFile, string sHash, string sPlain, string sBinary);\r
136 \r
137 #endif\r