Ignore:
Timestamp:
Dec 8, 2009, 3:31:08 PM (12 years ago)
Author:
arnold
Message:

Beta Version of Distributed KeySearcher with P2PManager und P2PWorker.

File:
1 edited

Legend:

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

    r959 r971  
    393393            if (sender == null || costMaster == null)
    394394                return;
     395            if (!Pattern.testWildcardKey(settings.Key))
     396            {
     397                GuiLogMessage("Wrong key pattern!", NotificationLevel.Error);
     398                return;
     399            }
     400            Pattern.WildcardKey = settings.Key;
    395401            bruteforcePattern(Pattern, sender);
    396402        }
    397403
     404        // modified by Christian Arnold 2009.12.07 - return type LinkedList (top10List)
    398405        // main entry point to the KeySearcher
    399         private void bruteforcePattern(KeyPattern pattern, IControlEncryption sender)
     406        private LinkedList<ValueKey> bruteforcePattern(KeyPattern pattern, IControlEncryption sender)
    400407        {
    401408            int maxInList = 10;
     
    407414            {
    408415                GuiLogMessage("Wrong key pattern!", NotificationLevel.Error);
    409                 return;
     416                return null;
    410417            }
    411418
     
    419426            {
    420427                GuiLogMessage("Bytes used not valid: " + ex.Message, NotificationLevel.Error);
    421                 return;
    422             }
    423 
    424             pattern.WildcardKey = settings.Key;
     428                return null;
     429            }
     430
    425431            BigInteger size = pattern.size();
    426432            KeyPattern[] patterns = splitPatternForThreads(pattern);
     
    460466                    int id = -1;
    461467                    for (int i = 0; i < patterns.Length; i++)
    462                         if (keysleft[i] > max)
     468                        if (keysleft[i] != null && keysleft[i] > max)
    463469                        {
    464470                            max = keysleft[i];
     
    488494            if (!stop)
    489495                ProgressChanged(1, 1);
     496
     497            return costList;
    490498        }
    491499
     
    691699        }
    692700
    693         // modified by Arnie - 2009.12.02
     701        // set to protected by Christian Arnold - 2009.12.06
    694702        protected virtual void onStatusChanged(IControl sender, bool readyForExecution)
    695703        {
     
    699707            }
    700708        }
     709
     710
     711        // added by Arnie - 2009.12.07
     712        public delegate void BruteforcingEnded(LinkedList<ValueKey> top10List);
     713        /// <summary>
     714        /// This event gets thrown after Bruteforcing had ended. This is no evidence, that bruteforcing was successful.
     715        /// But when the returned List is filled, we have (at least a part) of the possible best keys
     716        /// </summary>
     717        public event BruteforcingEnded OnBruteforcingEnded;
    701718
    702719        // added by Arnie -2009.12.02
     
    706723            ControlMaster = encryptControl;
    707724            CostMaster = costControl;
    708             bruteforcePattern(pattern, encryptControl);
     725            LinkedList<ValueKey> lstRet = bruteforcePattern(pattern, encryptControl);
     726            if(OnBruteforcingEnded != null)
     727                OnBruteforcingEnded(lstRet);
    709728        }
    710729
     
    726745        }
    727746
     747        // modified by Christian Arnold - 2009.12.07 (to public)
    728748        /// <summary>
    729749        /// used for delivering the results from the worker threads to the main thread:
    730750        /// </summary>
    731         private struct ValueKey
     751        public struct ValueKey
    732752        {
    733753            public double value;
Note: See TracChangeset for help on using the changeset viewer.