]> git.sesse.net Git - freerainbowtables/blob - Client Applications/converti2/Public.h
actually commit everything
[freerainbowtables] / Client Applications / converti2 / 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
30 #include <string>
31 #include <vector>
32 #include <list>
33
34 #include "global.h"
35
36 using namespace std;
37
38 struct RainbowChain
39 {
40         uint64 nIndexS;
41         uint64 nIndexE;
42 };
43
44 struct RainbowChainCP
45 {
46         uint64 nIndexS;
47         uint64 nIndexE;
48         unsigned short nCheckPoint;
49 };
50 struct IndexChain
51 {
52         uint64 nPrefix;
53         int nFirstChain;
54         unsigned int nChainCount;
55 };
56 struct FoundRainbowChain
57 {
58         uint64 nIndexS;
59         int nIndexE;
60         int nCheckPoint;
61         int nGuessedPos;
62 };
63 struct ChainCheckChain
64 {
65         uint64 nIndexS;
66         int nGuessedPos;
67 };
68 struct IndexRow
69 {
70         uint64 prefix;
71         unsigned int prefixstart, numchains;
72 };
73
74 typedef struct
75 {
76         string sName;
77         int nPlainLenMin;
78         int nPlainLenMax;
79 } tCharset;
80
81 #define MAX_PLAIN_LEN 256
82 #define MIN_HASH_LEN  8
83 #define MAX_HASH_LEN  256
84 #define MAX_SALT_LEN  256
85
86 // XXX nmap is GPL2, will check newer releases regarding license
87 // Code comes from nmap, used for the linux implementation of kbhit()
88 #ifndef _WIN32
89 #include <unistd.h>
90 #include <termios.h>
91 #include <fcntl.h>
92
93 int tty_getchar();
94 void tty_done();
95 void tty_init();
96 void tty_flush(void);
97 // end nmap code
98
99 #endif
100
101 unsigned int GetFileLen(FILE* file);
102 string TrimString(string s);
103 bool ReadLinesFromFile(string sPathName, vector<string>& vLine);
104 bool SeperateString(string s, string sSeperator, vector<string>& vPart);
105 string uint64tostr(uint64 n);
106 string uint64tohexstr(uint64 n);
107 string HexToStr(const unsigned char* pData, int nLen);
108 uint64 GetAvailPhysMemorySize();
109 void ParseHash(string sHash, unsigned char* pHash, int& nHashLen);
110 bool GetHybridCharsets(string sCharset, vector<tCharset>& vCharset);
111 void Logo();
112
113 #endif