]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/Public.h
050884242c1b2799be8789b9b109d146a679e5ff
[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 \r
40 struct RainbowChainO\r
41 {\r
42         uint64 nIndexS;\r
43         uint64 nIndexE;\r
44 };\r
45 //struct RainbowChain\r
46 //{\r
47 //      //uint64 nChain;\r
48 //      uint64 nIndexS;\r
49 //      int nIndexE;\r
50 //      int nCheckPoint;\r
51 //};\r
52 union RainbowChain\r
53 {\r
54         //uint64 nChain;\r
55         uint64 nIndexS; \r
56         struct\r
57         {\r
58                 unsigned short foo[3];\r
59                 unsigned short nIndexE;\r
60         };\r
61         //int nCheckPoint;\r
62 };\r
63 //struct RainbowChain\r
64 //{\r
65 //      uint64 nIndexS : 48;\r
66 //      unsigned short nIndexE : 16;\r
67 //};\r
68 //struct IndexChain\r
69 //{\r
70 //      uint64 nPrefix;\r
71 //      int nFirstChain;\r
72 //      int nChainCount;\r
73 //      //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)\r
74 //};\r
75 #pragma pack(1)\r
76 union IndexChain\r
77 {\r
78         uint64 nPrefix; //5\r
79         struct\r
80         {\r
81                 unsigned char foo[5];\r
82                 int nFirstChain; //4\r
83                 unsigned short nChainCount; //2\r
84         };\r
85         //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)\r
86 };\r
87 #pragma pack()\r
88 typedef struct\r
89 {\r
90         string sName;\r
91         int nPlainLenMin;\r
92         int nPlainLenMax;\r
93 } tCharset;\r
94 \r
95 #define MAX_PLAIN_LEN 256\r
96 #define MIN_HASH_LEN  8\r
97 #define MAX_HASH_LEN  256\r
98 #define MAX_SALT_LEN  256\r
99 \r
100 // XXX nmap is GPL2, will check newer releases regarding license\r
101 // Code comes from nmap, used for the linux implementation of kbhit()\r
102 #ifndef _WIN32\r
103 #include <unistd.h>\r
104 #include <termios.h>\r
105 #include <fcntl.h>\r
106 \r
107 int tty_getchar();\r
108 void tty_done();\r
109 void tty_init();\r
110 void tty_flush(void);\r
111 // end nmap code\r
112 \r
113 #endif\r
114 \r
115 #if defined(_WIN32) && !defined(__GNUC__)\r
116         int gettimeofday( struct timeval *tv, struct timezone *tz );\r
117 #endif\r
118 \r
119 #if !defined(_WIN32) || defined(__GNUC__)\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 SeperateString(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