]> git.sesse.net Git - freerainbowtables/blob - BOINC software/BOINC server apps/distrrtgen_validator/Public.h
initial
[freerainbowtables] / BOINC software / BOINC server apps / distrrtgen_validator / 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
12 #include <string>
13 #include <string.h>
14 #include <cstdlib>
15 #include <vector>
16 #include <list>
17 using namespace std;
18 #define CHARSET_TXT "/home/frt/projects/distrrtgen/download/charset.txt"
19 #ifdef _WIN32
20         #define uint64 unsigned __int64
21 #else
22         #define uint64 unsigned long long
23 #endif
24
25 struct RainbowChain
26 {
27         uint64 nIndexS;
28         uint64 nIndexE;
29 };
30 struct RainbowChainCP
31 {
32         uint64 nIndexS;
33         uint64 nIndexE;
34         unsigned short nCheckPoint;
35 };
36 struct IndexChain
37 {
38         uint64 nPrefix;
39         int nFirstChain;
40         unsigned int nChainCount;
41 };
42 struct FoundRainbowChain
43 {
44         uint64 nIndexS;
45         int nIndexE;
46         int nCheckPoint;
47         int nGuessedPos;
48 };
49 struct IndexRow
50 {
51         uint64 prefix;
52         unsigned int prefixstart, numchains;
53 };
54
55 typedef struct
56 {
57         string sName;
58         int nPlainLenMin;
59         int nPlainLenMax;
60 } tCharset;
61
62 #define MAX_PLAIN_LEN 256
63 #define MIN_HASH_LEN  8
64 #define MAX_HASH_LEN  256
65 #define MAX_SALT_LEN  256
66
67 unsigned int GetFileLen(FILE* file);
68 string TrimString(string s);
69 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);
70 bool SeperateString(string s, string sSeperator, vector<string>& vPart);
71 string uint64tostr(uint64 n);
72 string uint64tohexstr(uint64 n);
73 string HexToStr(const unsigned char* pData, int nLen);
74 unsigned int GetAvailPhysMemorySize();
75 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
76 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
77 void Logo();
78
79 #endif