Ignore:
Timestamp:
Oct 23, 2010, 1:35:01 PM (11 years ago)
Author:
Sven Rech
Message:

small keysearcher "keys/sec" fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/KeySearcher.cs

    r2002 r2009  
    591591            startThreads(sender, bytesToUse, patterns, doneKeysA, keycounters, keysleft, threadStack);
    592592
     593            DateTime lastTime = DateTime.Now;
     594
    593595            //update message:
    594596            while (!stop)
     
    633635                #endregion
    634636
     637                long keysPerSecond = (long)((long)doneKeys/(DateTime.Now - lastTime).TotalSeconds);
     638                lastTime = DateTime.Now;
    635639                if (redirectResultsToStatisticsGenerator)
    636640                {
    637                     distributedBruteForceManager.StatisticsGenerator.ShowProgress(costList, size, keycounter, doneKeys);
     641                    distributedBruteForceManager.StatisticsGenerator.ShowProgress(costList, size, keycounter, keysPerSecond);
    638642                }
    639643                else
    640644                {
    641                     showProgress(costList, size, keycounter, doneKeys);
     645                    showProgress(costList, size, keycounter, keysPerSecond);                   
    642646                }
    643647               
     
    694698        }
    695699
    696         internal void showProgress(LinkedList<ValueKey> costList, BigInteger size, BigInteger keycounter, BigInteger doneKeys)
     700        internal void showProgress(LinkedList<ValueKey> costList, BigInteger size, BigInteger keycounter, long keysPerSecond)
    697701        {
    698702            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
     
    701705            ProgressChanged((double)keycounter / (double) size, 1.0);
    702706
    703             if (localQuickWatchPresentation.IsVisible && doneKeys != 0 && !stop)
    704             {
    705                 double time = (Math.Pow(10, BigInteger.Log((size - keycounter), 10) - BigInteger.Log(doneKeys, 10)));
     707            if (localQuickWatchPresentation.IsVisible && keysPerSecond != 0 && !stop)
     708            {
     709                double time = (Math.Pow(10, BigInteger.Log((size - keycounter), 10) - Math.Log10(keysPerSecond)));
    706710                TimeSpan timeleft = new TimeSpan(-1);
    707711
     
    729733                {
    730734                    localQuickWatchPresentation.elapsedTime.Content = localBruteForceStopwatch.Elapsed;
    731 
    732                     localQuickWatchPresentation.keysPerSecond.Content = "" + doneKeys;
     735                    localQuickWatchPresentation.keysPerSecond.Content = "" + keysPerSecond;
    733736                    if (timeleft != new TimeSpan(-1))
    734737                    {
Note: See TracChangeset for help on using the changeset viewer.