]> git.sesse.net Git - freerainbowtables/blob - Common/rt api/RTI2Reader.h
dadde2aaf35c4da039ce321f56c9fc228fe5a194
[freerainbowtables] / Common / rt api / RTI2Reader.h
1 /*
2  * freerainbowtables is a project for generating, distributing, and using
3  * perfect rainbow tables
4  *
5  * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
6  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
7  *
8  * This file is part of freerainbowtables.
9  *
10  * freerainbowtables is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * freerainbowtables is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with freerainbowtables.  If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #ifndef __RTI2READER_H__
25 #define __RTI2READER_H__
26
27 #include "Public.h"
28 #include <string>
29
30 #if defined(_WIN32) && !defined(__GNUC__)
31         #include <io.h>
32 #endif
33
34 #include <vector>
35 #include "BaseRTReader.h"
36
37 using namespace std;
38
39 typedef struct 
40 {
41         char header[4];
42         unsigned char rti_startptlength, rti_endptlength, rti_cplength, rti_index_numchainslength;
43         uint64 prefixstart;
44         unsigned int *m_cppos;
45 } RTI2Header;
46
47 class RTI2Reader : BaseRTReader
48 {
49 private:
50         FILE *m_pFile;
51         uint32 m_chainPosition;
52         unsigned char *m_pPos, *m_pChainPos;
53         static RTI2Header *m_pHeader;
54         unsigned char *m_pIndex;
55         uint32 m_chainsizebytes;
56         uint32 m_indexrowsizebytes;
57         
58
59 public:
60         RTI2Reader(string Filename);
61         ~RTI2Reader(void);
62         int ReadChains(uint32 &numChains, RainbowChain *pData);
63         unsigned int GetChainsLeft();
64         static RTI2Header *GetHeader() { return m_pHeader; }
65 };
66
67
68 #endif