2 RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
4 Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
7 #ifndef _CHAINWALKCONTEXT_H
8 #define _CHAINWALKCONTEXT_H
10 #include "HashRoutine.h"
15 unsigned char m_PlainCharset[255];
16 int m_nPlainCharsetLen;
19 string m_sPlainCharsetName;
20 string m_sPlainCharsetContent;
22 class CChainWalkContext
26 virtual ~CChainWalkContext();
29 static string m_sHashRoutineName;
30 static HASHROUTINE m_pHashRoutine; // Configuration
31 static int m_nHashLen; // Configuration
32 static bool isOldRtFormat;
33 static bool isNewRtFormat;
34 static vector<stCharset> m_vCharset;
35 static int m_nPlainLenMinTotal, m_nPlainLenMaxTotal;
36 static uint64 m_nPlainSpaceUpToX[MAX_PLAIN_LEN + 1]; // Performance consideration
37 static uint64 m_nPlainSpaceTotal; // Performance consideration
38 static int m_nHybridCharset;
39 static int m_nRainbowTableIndex; // Configuration
40 static uint64 m_nReduceOffset; // Performance consideration
44 unsigned char m_Plain[MAX_PLAIN_LEN];
46 unsigned char m_Hash[MAX_HASH_LEN];
47 static unsigned char m_Salt[MAX_SALT_LEN];
48 static int m_nSaltLen;
50 static bool LoadCharset(string sCharset);
53 static bool SetHashRoutine(string sHashRoutineName); // Configuration
54 static bool SetPlainCharset(string sCharsetName, int nPlainLenMin, int nPlainLenMax); // Configuration
55 static bool SetRainbowTableIndex(int nRainbowTableIndex);
56 static bool SetSalt(unsigned char *Salt, int nSaltLength);// Configuration
57 static bool SetupWithPathName(string sPathName, int& nRainbowChainLen, int& nRainbowChainCount); // Wrapper
58 static string GetHashRoutineName();
59 static int GetHashLen();
60 static string GetPlainCharsetName();
61 static string GetPlainCharsetContent();
62 static int GetPlainLenMin();
63 static int GetPlainLenMax();
64 static uint64 GetPlainSpaceTotal();
65 static int GetRainbowTableIndex();
67 static bool isOldFormat();
68 static bool isNewFormat();
70 void SetIndex(uint64 nIndex);
71 void SetHash(unsigned char* pHash); // The length should be m_nHashLen
75 void HashToIndex(int nPos);
78 const uint64* GetIndexPtr();
82 bool CheckHash(unsigned char* pHash); // The length should be m_nHashLen