]> git.sesse.net Git - freerainbowtables/blob - Common/rt api/RTReader.cpp
fc8166bc14b2579bc27d847f8950fb1f289c7c4f
[freerainbowtables] / Common / rt api / RTReader.cpp
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 #include "RTReader.h"
25
26 RTReader::RTReader(string Filename)
27 {
28         m_pFile = fopen(Filename.c_str(), "rb");
29 }
30
31 RTReader::~RTReader(void)
32 {
33 }
34
35 int RTReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
36 {
37         unsigned int numRead = fread(pData, 1, 16 * numChains, m_pFile);
38         numChains = numRead / 16;
39         m_chainPosition += numChains;
40         return 0;
41 }
42 UINT4 RTReader::GetChainsLeft()
43 {
44         return (GetFileLen(m_pFile) / 16) - m_chainPosition;
45 }