X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=Client%20Applications%2Frcracki_mt%2FCrackEngine.cpp;h=8d3981e64b42124c29dd6836fd176930b2fd0156;hb=be9db72731412fad58246851d4f345c01392351c;hp=107201ab32c9577c2ae449e06a707e203d49264d;hpb=b3e14a93645a48910b1c608c9bbf276479786f95;p=freerainbowtables diff --git a/Client Applications/rcracki_mt/CrackEngine.cpp b/Client Applications/rcracki_mt/CrackEngine.cpp index 107201a..8d3981e 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 @@ -1069,11 +1074,10 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) if ( doRti2Format ) { nDataRead = nAllocatedSize / 16; - pReader->ReadChains(nDataRead, pChain); + if(pReader->GetChainsLeft() <= 0) // No more data + break; + pReader->ReadChains(nDataRead, (RainbowChain*)pChain); nDataRead *= 8; // Convert from chains read to bytes - - if ( nDataRead == 0 ) // No more data - break; } else { @@ -1087,7 +1091,9 @@ void CCrackEngine::SearchRainbowTable(string sPathName, CHashSet& hs) m_fTotalDiskAccessTime += fTime; int nRainbowChainCountRead = nDataRead / 16; - + if(doRti2Format) { + nRainbowChainCountRead = nDataRead / 8; + } // Verify table chunk if (!fVerified) {