Ignore:
Timestamp:
Dec 4, 2009, 8:07:43 PM (12 years ago)
Author:
arnold
Message:

Minimal extended version (new BruteforcePattern method for distant calls)

File:
1 edited

Legend:

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

    r939 r951  
    4141            {
    4242                pattern = value;
    43                 if ((settings.Key == null) ||((settings.Key != null) && !pattern.testKey(settings.Key)))
     43                if ((settings.Key == null) || ((settings.Key != null) && !pattern.testKey(settings.Key)))
    4444                    settings.Key = pattern.giveWildcardKey();
    4545            }
     
    170170        #endregion
    171171
    172 /* BEGIN functionality */
     172        /* BEGIN functionality */
    173173
    174174        #region whole KeySearcher functionality
     
    190190            BigInteger[] keycounterArray = (BigInteger[])parameters[3];
    191191            BigInteger[] keysLeft = (BigInteger[])parameters[4];
    192             IControlEncryption sender = (IControlEncryption)parameters[5];           
     192            IControlEncryption sender = (IControlEncryption)parameters[5];
    193193            int bytesToUse = (int)parameters[6];
    194194            Stack threadStack = (Stack)parameters[7];
     
    269269                        {
    270270                            if (!decryptAndCalculate(sender, bytesToUse, ref valueKey, keya, 0, null))
    271                                 return;                           
     271                                return;
    272272                            doneKeysArray[threadid]++;
    273273                            keycounterArray[threadid]++;
     
    309309        #region bruteforce methods
    310310
    311         private bool bruteforceBlock(IControlEncryption sender, int bytesToUse, ref ValueKey valueKey, byte[] keya, int[] arrayPointers, 
     311        private bool bruteforceBlock(IControlEncryption sender, int bytesToUse, ref ValueKey valueKey, byte[] keya, int[] arrayPointers,
    312312            int[] arraySuccessors, int[] arrayUppers, int arrayPointer, ref int counter, KeyPattern pattern)
    313313        {
     
    315315            while (!stop)
    316316            {
    317                 if (arrayPointer+1 < arrayPointers.Length && arrayPointers[arrayPointer+1] != -1)
     317                if (arrayPointer + 1 < arrayPointers.Length && arrayPointers[arrayPointer + 1] != -1)
    318318                {
    319319                    if (!bruteforceBlock(sender, bytesToUse, ref valueKey, keya, arrayPointers, arraySuccessors, arrayUppers, arrayPointer + 1, ref counter, pattern))
     
    620620                }
    621621                else
    622                 {                   
     622                {
    623623                    if (vk.value < costList.Last().value)
    624624                    {
     
    689689        }
    690690
    691         private void onStatusChanged(IControl sender, bool readyForExecution)
     691        // modified by Arnie - 2009.12.02
     692        protected virtual void onStatusChanged(IControl sender, bool readyForExecution)
    692693        {
    693694            if (readyForExecution)
     
    695696                this.process((IControlEncryption)sender);
    696697            }
     698        }
     699
     700        // added by Arnie -2009.12.02
     701        // for inheritance reasons
     702        public void BruteforcePattern(KeyPattern pattern, IControlEncryption encryptControl, IControlCost costControl)
     703        {
     704            ControlMaster = encryptControl;
     705            CostMaster = costControl;
     706            bruteforcePattern(pattern, encryptControl);
    697707        }
    698708
Note: See TracChangeset for help on using the changeset viewer.