]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/rcrackiThread.h
backport rcracki_mt trunk from rcracki.sourceforge.net
[freerainbowtables] / Client Applications / rcracki_mt / rcrackiThread.h
1 /*\r
2  * rcracki_mt is a multithreaded implementation and fork of the original \r
3  * RainbowCrack\r
4  *\r
5  * Copyright 2009, 2010 DaniĆ«l Niggebrugge <niggebrugge@fox-it.com>\r
6  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>\r
7  *\r
8  * This file is part of rcracki_mt.\r
9  *\r
10  * rcracki_mt is free software: you can redistribute it and/or modify\r
11  * it under the terms of the GNU General Public License as published by\r
12  * the Free Software Foundation, either version 2 of the License, or\r
13  * (at your option) any later version.\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 #ifdef _WIN32\r
25         #pragma once\r
26 #endif\r
27 \r
28 #include "ChainWalkContext.h"\r
29 #include "Public.h"\r
30 #include "HashSet.h"\r
31 //#include <process.h>\r
32 #include <pthread.h>\r
33 \r
34 class rcrackiThread\r
35 {\r
36 private:\r
37         unsigned char* t_TargetHash;\r
38         int t_nPos;\r
39         int t_nRainbowChainLen;\r
40         CChainWalkContext t_cwc;\r
41         vector<uint64> t_vStartPosIndexE;\r
42         int t_ID;\r
43         int t_count;\r
44         uint64* t_pStartPosIndexE;\r
45         int t_nChainWalkStep;\r
46         bool falseAlarmChecker;\r
47         bool falseAlarmCheckerO;\r
48         vector<RainbowChain *> t_pChainsFound;\r
49         vector<RainbowChainO *> t_pChainsFoundO;\r
50         vector<int> t_nGuessedPoss;\r
51         unsigned char* t_pHash;\r
52         bool foundHash;\r
53         int t_nChainWalkStepDueToFalseAlarm;\r
54         int t_nFalseAlarm;\r
55         string t_Hash;\r
56         string t_Plain;\r
57         string t_Binary;\r
58 \r
59 public:\r
60         rcrackiThread(unsigned char* TargetHash, int thread_id, int nRainbowChainLen, int thread_count, uint64* pStartPosIndexE);\r
61         rcrackiThread(unsigned char* pHash, bool oldFormat = false);\r
62         rcrackiThread(void);\r
63         ~rcrackiThread(void);\r
64 \r
65         //void SetWork(unsigned char* TargetHash, int nPos, int nRainbowChainLen);\r
66         //static unsigned __stdcall rcrackiThread::rcrackiThreadStaticEntryPoint(void * pThis);\r
67         static void * rcrackiThreadStaticEntryPointPthread(void * pThis);\r
68         int GetIndexCount();\r
69         int GetChainWalkStep();\r
70         uint64 GetIndex(int nPos);\r
71         bool FoundHash();\r
72         void AddAlarmCheck(RainbowChain* pChain, int nGuessedPos);\r
73         void AddAlarmCheckO(RainbowChainO* pChain, int nGuessedPos);\r
74         int GetChainWalkStepDueToFalseAlarm();\r
75         int GetnFalseAlarm();\r
76         string GetHash();\r
77         string GetPlain();\r
78         string GetBinary();\r
79 \r
80 private:\r
81         void rcrackiThreadEntryPoint();\r
82         void PreCalculate();\r
83         void CheckAlarm();\r
84         void CheckAlarmO();\r
85 };\r