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