Ignore:
Timestamp:
Jun 18, 2010, 5:18:05 PM (11 years ago)
Author:
Paul Lelgemann
Message:

o Refactored distributed KeySearcher: updated directory structure and variable names

File:
1 edited

Legend:

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

    r1647 r1674  
    1212using System.Threading;
    1313using System.Windows.Threading;
    14 using Cryptool.PluginBase.Miscellaneous;
    15 using System.IO;
    1614using Cryptool.PluginBase.IO;
    1715using System.Numerics;
    1816using KeySearcher.Helper;
    1917using KeySearcher.P2P;
     18using KeySearcher.Presentation;
    2019
    2120namespace KeySearcher
     
    3837        private KeyQualityHelper _keyQualityHelper;
    3938
    40         private KeyPattern pattern = null;
    41         public KeyPattern Pattern
     39        private KeyPattern.KeyPattern pattern = null;
     40        public KeyPattern.KeyPattern Pattern
    4241        {
    4342            get
     
    7271                if (value != null)
    7372                {
    74                     Pattern = new KeyPattern(value.getKeyPattern());
     73                    Pattern = new KeyPattern.KeyPattern(value.getKeyPattern());
    7574                    value.keyPatternChanged += keyPatternChanged;
    7675                    controlMaster = value;
     
    300299        {
    301300            object[] parameters = (object[])param;
    302             KeyPattern[] patterns = (KeyPattern[])parameters[0];
     301            KeyPattern.KeyPattern[] patterns = (KeyPattern.KeyPattern[])parameters[0];
    303302            int threadid = (int)parameters[1];
    304303            BigInteger[] doneKeysArray = (BigInteger[])parameters[2];
     
    309308            Stack threadStack = (Stack)parameters[7];
    310309
    311             KeyPattern pattern = patterns[threadid];
     310            KeyPattern.KeyPattern pattern = patterns[threadid];
    312311
    313312            bool useKeyblocks = false;
     
    331330                                if (maxThread == threadid && threadStack.Count != 0)
    332331                                {
    333                                     KeyPattern[] split = pattern.split();
     332                                    KeyPattern.KeyPattern[] split = pattern.split();
    334333                                    if (split != null)
    335334                                    {
     
    427426
    428427        private bool bruteforceBlock(IControlEncryption sender, int bytesToUse, ref ValueKey valueKey, byte[] keya, int[] arrayPointers,
    429             int[] arraySuccessors, int[] arrayUppers, int arrayPointer, ref int counter, KeyPattern pattern)
     428            int[] arraySuccessors, int[] arrayUppers, int arrayPointer, ref int counter, KeyPattern.KeyPattern pattern)
    430429        {
    431430            byte store = keya[arrayPointers[arrayPointer]];
     
    457456        }
    458457
    459         private bool decryptAndCalculate(IControlEncryption sender, int bytesToUse, ref ValueKey valueKey, byte[] keya, int counter, KeyPattern pattern)
     458        private bool decryptAndCalculate(IControlEncryption sender, int bytesToUse, ref ValueKey valueKey, byte[] keya, int counter, KeyPattern.KeyPattern pattern)
    460459        {
    461460            try
     
    551550        // modified by Christian Arnold 2009.12.07 - return type LinkedList (top10List)
    552551        // main entry point to the KeySearcher
    553         private LinkedList<ValueKey> bruteforcePattern(KeyPattern pattern)
     552        private LinkedList<ValueKey> bruteforcePattern(KeyPattern.KeyPattern pattern)
    554553        {
    555554            //For evaluation issues - added by Arnold 2010.03.17
     
    599598            GuiLogMessage("Launching p2p based bruteforce logic...", NotificationLevel.Info);
    600599            ValidateConnectionToPeerToPeerSystem();
    601             new P2PBruteForce(this, pattern, settings, _keyQualityHelper);
     600            var bruteForceManager = new DistributedBruteForceManager(this, pattern, settings, _keyQualityHelper);
     601            bruteForceManager.Execute();
    602602        }
    603603
     
    650650        #endregion
    651651
    652         internal LinkedList<ValueKey> BruteForceWithLocalSystem(KeyPattern pattern)
     652        internal LinkedList<ValueKey> BruteForceWithLocalSystem(KeyPattern.KeyPattern pattern)
    653653        {
    654654            BigInteger size = pattern.size();
    655             KeyPattern[] patterns = splitPatternForThreads(pattern);
     655            KeyPattern.KeyPattern[] patterns = splitPatternForThreads(pattern);
    656656
    657657            BigInteger[] doneKeysA = new BigInteger[patterns.Length];
     
    950950        #endregion
    951951
    952         private void startThreads(IControlEncryption sender, int bytesToUse, KeyPattern[] patterns, BigInteger[] doneKeysA, BigInteger[] keycounters, BigInteger[] keysleft, Stack threadStack)
     952        private void startThreads(IControlEncryption sender, int bytesToUse, KeyPattern.KeyPattern[] patterns, BigInteger[] doneKeysA, BigInteger[] keycounters, BigInteger[] keysleft, Stack threadStack)
    953953        {
    954954            for (int i = 0; i < patterns.Length; i++)
     
    962962        }
    963963
    964         private KeyPattern[] splitPatternForThreads(KeyPattern pattern)
    965         {
    966             KeyPattern[] patterns = new KeyPattern[settings.CoresUsed + 1];
     964        private KeyPattern.KeyPattern[] splitPatternForThreads(KeyPattern.KeyPattern pattern)
     965        {
     966            KeyPattern.KeyPattern[] patterns = new KeyPattern.KeyPattern[settings.CoresUsed + 1];
    967967            if (settings.CoresUsed > 0)
    968968            {
    969                 KeyPattern[] patterns2 = pattern.split();
     969                KeyPattern.KeyPattern[] patterns2 = pattern.split();
    970970                if (patterns2 == null)
    971971                {
    972                     patterns2 = new KeyPattern[1];
     972                    patterns2 = new KeyPattern.KeyPattern[1];
    973973                    patterns2[0] = pattern;
    974974                    return patterns2;
     
    988988                            maxPattern = i;
    989989                        }
    990                     KeyPattern[] patterns3 = patterns[maxPattern].split();
     990                    KeyPattern.KeyPattern[] patterns3 = patterns[maxPattern].split();
    991991                    if (patterns3 == null)
    992992                    {
    993                         patterns3 = new KeyPattern[p+1];
     993                        patterns3 = new KeyPattern.KeyPattern[p+1];
    994994                        for (int i = 0; i <= p; i++)
    995995                            patterns3[i] = patterns[i];
     
    10081008        private void keyPatternChanged()
    10091009        {
    1010             Pattern = new KeyPattern(controlMaster.getKeyPattern());
     1010            Pattern = new KeyPattern.KeyPattern(controlMaster.getKeyPattern());
    10111011        }
    10121012
     
    10211021        // added by Arnie -2009.12.02
    10221022        // for inheritance reasons
    1023         public void BruteforcePattern(KeyPattern pattern, byte[] encryptedData, byte[] initVector, IControlEncryption encryptControl, IControlCost costControl)
     1023        public void BruteforcePattern(KeyPattern.KeyPattern pattern, byte[] encryptedData, byte[] initVector, IControlEncryption encryptControl, IControlCost costControl)
    10241024        {
    10251025            /* Begin: New stuff because of changing the IControl data flow - Arnie 2010.01.18 */
Note: See TracChangeset for help on using the changeset viewer.