X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=Client%20Applications%2Frcracki_mt%2FCrackEngine.cpp;h=0a4b1818bb9eb889771e94017cc28fb0ee9302c2;hb=3d42602c1f746b5768f0e6c9d22884a9806eadc0;hp=7640a6310211340cdd4aef3b69aa75ccd34bbbae;hpb=2fc61ff60954ebd5d560acfe3dc9653064ce40b5;p=freerainbowtables diff --git a/Client Applications/rcracki_mt/CrackEngine.cpp b/Client Applications/rcracki_mt/CrackEngine.cpp index 7640a63..0a4b181 100644 --- a/Client Applications/rcracki_mt/CrackEngine.cpp +++ b/Client Applications/rcracki_mt/CrackEngine.cpp @@ -1044,7 +1044,12 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) } static CMemoryPool mp(bytesForChainWalkSet, debug, maxMem); - RainbowChainO* pChain = (RainbowChainO*)mp.Allocate(nFileLen, nAllocatedSize); + RainbowChainO* pChain = NULL; + if(doRti2Format) { + pChain = (RainbowChainO*)mp.Allocate(pReader->GetChainsLeft() * 16, nAllocatedSize); + } else { + pChain = (RainbowChainO*)mp.Allocate(nFileLen, nAllocatedSize); + } #ifdef _WIN32 if (debug) printf("Allocated %I64u bytes, filelen %lu\n", nAllocatedSize, (unsigned long)nFileLen); #else @@ -1064,13 +1069,15 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) // Load table chunk if (debug) printf("reading...\n"); - unsigned int nDataRead = 0, nDataToRead = 0; + unsigned int nDataRead = 0; gettimeofday( &tv, NULL ); if ( doRti2Format ) { - nDataToRead = nAllocatedSize / 16; - nDataRead = nDataToRead; - pReader->ReadChains(nDataRead, pChain); + nDataRead = nAllocatedSize / 16; + if(pReader->GetChainsLeft() <= 0) // No more data + break; + pReader->ReadChains(nDataRead, (RainbowChain*)pChain); + nDataRead *= 8; // Convert from chains read to bytes } else @@ -1086,6 +1093,10 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) int nRainbowChainCountRead = nDataRead / 16; + if(doRti2Format) { + nRainbowChainCountRead = nDataRead / 8; + } + // Verify table chunk if (!fVerified) { @@ -1136,13 +1147,6 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) // Already finished? if (!hs.AnyHashLeftWithLen(CChainWalkContext::GetHashLen())) break; - - // finished the current table - if( doRti2Format && nDataToRead > (nDataRead / 8) ) - { - delete pReader; - break; - } } } else