Ignore:
Timestamp:
Jan 27, 2011, 5:49:14 PM (11 years ago)
Author:
nolte
Message:

Statistic Information Tab -> first stats added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/Presentation/Controls/StatisticsPresentation.xaml.cs

    r2498 r2506  
    44using System.Globalization;
    55using System.Linq;
     6using System.Numerics;
    67using System.Text;
    78using System.Threading;
     
    1718using System.Windows.Threading;
    1819using KeySearcher;
     20using KeySearcher.KeyPattern;
    1921
    2022namespace KeySearcherPresentation.Controls
     
    102104            }
    103105        }
     106
     107        #region Informations
     108
     109        public void UpdateInformation(KeySearcher.KeySearcher keySearcher, KeySearcherSettings keySearcherSettings)
     110        {
     111            if (keySearcher.Pattern == null || !keySearcher.Pattern.testWildcardKey(keySearcherSettings.Key) || keySearcherSettings.ChunkSize == 0)
     112            {
     113                return;
     114            }
     115
     116            var keyPattern = new KeyPattern(keySearcher.ControlMaster.getKeyPattern()) { WildcardKey = keySearcherSettings.Key };
     117            var keysPerChunk = Math.Pow(2, keySearcherSettings.ChunkSize);
     118            var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(keysPerChunk));
     119
     120            if (keyPatternPool.Length > 9999999999)
     121            {
     122                TotalAmountOfBlocks.Content = keyPatternPool.Length.ToString().Substring(0, 10) + "...";
     123            }
     124            else
     125            {
     126                TotalAmountOfBlocks.Content = keyPatternPool.Length;
     127            }
     128
     129            TotalAmountOfKeys.Content = new BigInteger(keysPerChunk) * keyPatternPool.Length;
     130
     131
     132            //Under Construction
     133            //--------
     134            TotalBlocksTested.Content = "???";
     135            TotalKeysTested.Content = "???";
     136            //--------
     137        }
     138        #endregion
    104139    }
    105140
Note: See TracChangeset for help on using the changeset viewer.