]> git.sesse.net Git - freerainbowtables/blob - Client Applications/rcracki_mt/Public.h
rcracki_mt updated to rti2
[freerainbowtables] / Client Applications / rcracki_mt / Public.h
1 /*
2    RainbowCrack - a general propose implementation of Philippe Oechslin's faster time-memory trade-off technique.
3
4    Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
5 */
6
7 #ifndef _PUBLIC_H
8 #define _PUBLIC_H
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 #include <string>
15 #include <vector>
16 #include <list>
17 using namespace std;
18
19 #ifdef _WIN32
20         #define uint64 unsigned __int64
21 #else
22         #ifndef u_int64_t
23                 #define uint64 unsigned long long
24         #else
25                 #define uint64 u_int64_t
26         #endif
27 #endif
28
29 struct RainbowChainO
30 {
31         uint64 nIndexS;
32         uint64 nIndexE;
33 };
34 //struct RainbowChain
35 //{
36 //      //uint64 nChain;
37 //      uint64 nIndexS;
38 //      int nIndexE;
39 //      int nCheckPoint;
40 //};
41
42 union RainbowChain
43 {
44         //uint64 nChain;
45         uint64 nIndexS; 
46         struct
47         {
48                 unsigned short foo[3];
49                 unsigned short nIndexE;
50         };
51         //int nCheckPoint;
52 };
53 //struct RainbowChain
54 //{
55 //      uint64 nIndexS : 48;
56 //      unsigned short nIndexE : 16;
57 //};
58 //struct IndexChain
59 //{
60 //      uint64 nPrefix;
61 //      int nFirstChain;
62 //      int nChainCount;
63 //      //unsigned short nChainCount; //(maybe union with nPrefix, 1 byte spoiled)
64 //};
65 #pragma pack(1)
66 union IndexChain
67 {
68         uint64 nPrefix; //5
69         struct
70         {
71                 unsigned char foo[5];
72                 int nFirstChain; //4
73                 unsigned short nChainCount; //2
74         };
75         //unsigned short nChainCount; (maybe union with nPrefix, 1 byte spoiled, no pack(1) needed)
76 };
77 #pragma pack()
78 typedef struct
79 {
80         string sName;
81         int nPlainLenMin;
82         int nPlainLenMax;
83 } tCharset;
84
85 #define MAX_PLAIN_LEN 256
86 #define MIN_HASH_LEN  8
87 #define MAX_HASH_LEN  256
88 #define MAX_SALT_LEN  256
89
90 // Code comes from nmap, used for the linux implementation of kbhit()
91 #ifndef _WIN32
92 #include <unistd.h>
93 #include <termios.h>
94 #include <fcntl.h>
95
96 int tty_getchar();
97 void tty_done();
98 void tty_init();
99 void tty_flush(void);
100
101 #endif
102
103
104 unsigned int GetFileLen(FILE* file);
105 string TrimString(string s);
106 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);
107 bool SeperateString(string s, string sSeperator, vector<string>& vPart);
108 string uint64tostr(uint64 n);
109 string uint64tohexstr(uint64 n);
110 string HexToStr(const unsigned char* pData, int nLen);
111 unsigned int GetAvailPhysMemorySize();
112 string GetApplicationPath();
113 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
114 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
115 void Logo();
116 bool writeResultLineToFile(string sOutputFile, string sHash, string sPlain, string sBinary);
117
118 #endif