]> git.sesse.net Git - freerainbowtables/blob - Common/rt api/Public.h
64-bit fixes for distrrtgen
[freerainbowtables] / Common / rt api / Public.h
1 /*
2  * freerainbowtables is a project for generating, distributing, and using
3  * perfect rainbow tables
4  *
5  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
6  * Copyright 2009, 2010 DaniĆ«l Niggebrugge <niggebrugge@fox-it.com>
7  * Copyright 2009, 2010 James Nobis <frt@quelrod.net>
8  *
9  * This file is part of freerainbowtables.
10  *
11  * freerainbowtables is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * freerainbowtables is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with freerainbowtables.  If not, see <http://www.gnu.org/licenses/>.
23  */
24
25 #ifndef _PUBLIC_H
26 #define _PUBLIC_H
27
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31
32 #include <string>
33 #include <vector>
34 #include <list>
35
36 #include "global.h"
37
38 using namespace std;
39
40 struct RainbowChain
41 {
42         uint64 nIndexS;
43         uint64 nIndexE;
44 };
45
46 struct RainbowChainCP
47 {
48         uint64 nIndexS;
49         uint64 nIndexE;
50         unsigned short nCheckPoint;
51 };
52 struct IndexChain
53 {
54         uint64 nPrefix;
55         UINT4 nFirstChain;
56         UINT4 nChainCount;
57 };
58 struct FoundRainbowChain
59 {
60         uint64 nIndexS;
61         int nIndexE;
62         int nCheckPoint;
63         int nGuessedPos;
64 };
65 struct ChainCheckChain
66 {
67         uint64 nIndexS;
68         int nGuessedPos;
69 };
70 struct IndexRow
71 {
72         uint64 prefix;
73         unsigned int prefixstart, numchains;
74 };
75
76 typedef struct
77 {
78         string sName;
79         int nPlainLenMin;
80         int nPlainLenMax;
81 } tCharset;
82
83 #define MAX_PLAIN_LEN 256
84 #define MIN_HASH_LEN  8
85 #define MAX_HASH_LEN  256
86 #define MAX_SALT_LEN  256
87
88 unsigned int GetFileLen(FILE* file);
89 string TrimString(string s);
90 bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine);
91 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);
92 bool SeperateString(string s, string sSeperator, vector<string>& vPart);
93 string uint64tostr(uint64 n);
94 string uint64tohexstr(uint64 n);
95 string HexToStr(const unsigned char* pData, int nLen);
96 unsigned int GetAvailPhysMemorySize();
97 string GetApplicationPath();
98 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
99 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
100 void Logo();
101
102 #endif