2 * rcracki_mt is a multithreaded implementation and fork of the original
\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 James Nobis <frt@quelrod.net>
\r
9 * This file is part of rcracki_mt.
\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, either version 2 of the License, or
\r
14 * (at your option) any later version.
\r
16 * rcracki_mt is distributed in the hope that it will be useful,
\r
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
19 * GNU General Public License for more details.
\r
21 * You should have received a copy of the GNU General Public License
\r
22 * along with rcracki_mt. If not, see <http://www.gnu.org/licenses/>.
\r
25 #ifndef _CHAINWALKCONTEXT_H
\r
26 #define _CHAINWALKCONTEXT_H
\r
28 #include "HashRoutine.h"
\r
33 unsigned char m_PlainCharset[255];
\r
34 unsigned int m_nPlainCharsetLen;
\r
37 string m_sPlainCharsetName;
\r
38 string m_sPlainCharsetContent;
\r
40 class CChainWalkContext
\r
43 CChainWalkContext();
\r
44 virtual ~CChainWalkContext();
\r
47 static string m_sHashRoutineName;
\r
48 static HASHROUTINE m_pHashRoutine; // Configuration
\r
49 static int m_nHashLen; // Configuration
\r
50 static bool isOldRtFormat;
\r
51 static bool isRti2RtFormat;
\r
52 static vector<stCharset> m_vCharset;
\r
53 static int m_nPlainLenMinTotal, m_nPlainLenMaxTotal;
\r
54 static uint64 m_nPlainSpaceUpToX[MAX_PLAIN_LEN + 1]; // Performance consideration
\r
55 static uint64 m_nPlainSpaceTotal; // Performance consideration
\r
56 static int m_nHybridCharset;
\r
57 static int m_nRainbowTableIndex; // Configuration
\r
58 static uint64 m_nReduceOffset; // Performance consideration
\r
62 unsigned char m_Plain[MAX_PLAIN_LEN];
\r
64 unsigned char m_Hash[MAX_HASH_LEN];
\r
65 static unsigned char m_Salt[MAX_SALT_LEN];
\r
66 static int m_nSaltLen;
\r
68 static bool LoadCharset(string sCharset);
\r
71 static bool SetHashRoutine(string sHashRoutineName); // Configuration
\r
72 static bool SetPlainCharset(string sCharsetName, int nPlainLenMin, int nPlainLenMax); // Configuration
\r
73 static bool SetRainbowTableIndex(int nRainbowTableIndex);
\r
74 static bool SetSalt(unsigned char *Salt, int nSaltLength);// Configuration
\r
75 static bool SetupWithPathName(string sPathName, int& nRainbowChainLen, int& nRainbowChainCount); // Wrapper
\r
76 static string GetHashRoutineName();
\r
77 static int GetHashLen();
\r
78 static string GetPlainCharsetName();
\r
79 static string GetPlainCharsetContent();
\r
80 static int GetPlainLenMin();
\r
81 static int GetPlainLenMax();
\r
82 static uint64 GetPlainSpaceTotal();
\r
83 static int GetRainbowTableIndex();
\r
85 static bool isOldFormat();
\r
86 static bool isRti2Format();
\r
88 void SetIndex(uint64 nIndex);
\r
89 void SetHash(unsigned char* pHash); // The length should be m_nHashLen
\r
91 void IndexToPlain();
\r
93 void HashToIndex(int nPos);
\r
96 const uint64* GetIndexPtr();
\r
100 bool CheckHash(unsigned char* pHash); // The length should be m_nHashLen
\r