]> git.sesse.net Git - freerainbowtables/commitdiff
merged paths
authorMartin Westergaard <admin@freerainbowtables.com>
Mon, 1 Nov 2010 18:38:05 +0000 (19:38 +0100)
committerMartin Westergaard <admin@freerainbowtables.com>
Mon, 1 Nov 2010 18:38:05 +0000 (19:38 +0100)
1  2 
Client Applications/rcracki_mt/CrackEngine.cpp

index 7640a6310211340cdd4aef3b69aa75ccd34bbbae,8d3981e64b42124c29dd6836fd176930b2fd0156..0a4b1818bb9eb889771e94017cc28fb0ee9302c2
@@@ -1044,7 -1044,12 +1044,12 @@@ void CCrackEngine::SearchRainbowTable(s
                                }
  
                                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
  
                                                // 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
                                                m_fTotalDiskAccessTime += fTime;
  
                                                int nRainbowChainCountRead = nDataRead / 16;
 +
+                                               if(doRti2Format) {
+                                                       nRainbowChainCountRead = nDataRead / 8;
+                                               }
++
                                                // Verify table chunk
                                                if (!fVerified)
                                                {
                                                // Already finished?
                                                if (!hs.AnyHashLeftWithLen(CChainWalkContext::GetHashLen()))
                                                        break;
-                                               // finished the current table
-                                               if( doRti2Format && nDataToRead > (nDataRead / 8) )
-                                               {
-                                                       delete pReader;
-                                                       break;
-                                               }
                                        }
                                }
                                else