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