Ignore:
Timestamp:
Jan 20, 2010, 5:46:29 PM (12 years ago)
Author:
arnold
Message:

First testable version of network-comprehensive DES-Bruteforcing with P2PMAnager and P2PWorker.

File:
1 edited

Legend:

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

    r1098 r1100  
    114114        private KeySearcher_IControl keySearcher;
    115115
    116         #region for bruteforcing necessary data
    117         private KeyPattern actualKeyPattern;
    118         private byte[] encryptedData;
    119         private byte[] initVector;
    120         #endregion
    121 
    122         /// <summary>
    123         /// workaround: Flag which will be set, when the OnAllMasterControlsInitialized
    124         /// Event is thrown. So we can assure the correct flow of the KeySearcher
    125         /// </summary>
    126         private bool allMasterControlsInitialized = false;
    127         /// <summary>
    128         /// workaround: Flag which will be set, when a worker wants to
    129         /// bruteforce a pattern, but the MasterControls of the base
    130         /// KeySearcher aren't initialized yet. In this case the pattern
    131         /// will be stored in the variable actualKeyPattern and will be
    132         /// processed when the OnMasterControlsInitialized-Event is thrown
    133         /// </summary>
    134         private bool tryBruteforcingBeforeMastersInitialized = false;
    135 
    136116        public KeySearcherMaster(KeySearcher_IControl keysearcher)
    137117        {
    138118            this.keySearcher = keysearcher;
    139             // this.keySearcher.OnBruteforcingEnded +=new KeySearcher.KeySearcher.BruteforcingEnded(keySearcher_OnBruteforcingEnded);
    140             // subscribe to event before any bruteforcing has started, so we make sure that this event will thrown in every case
    141119            this.keySearcher.OnBruteforcingEnded += new KeySearcher.KeySearcher.BruteforcingEnded(keySearcher_OnBruteforcingEnded);
    142             //this.keySearcher.OnAllMasterControlsInitialized += new KeySearcher_IControl.IsReadyForExecution(keySearcher_OnAllMasterControlsInitialized);
    143120        }
    144121
     
    157134        public void StartBruteforcing(KeyPattern pattern, byte[] encryptedData, byte[] initVector)
    158135        {
    159             // if not all MasterControls are initialized, store the actual
    160             // pattern and wait for throwing the OnMasterControlsInitialized-Event
    161             //if (!allMasterControlsInitialized)
    162             //{
    163             //    tryBruteforcingBeforeMastersInitialized = true;
    164             //    this.actualKeyPattern = pattern;
    165             //    this.encryptedData = encryptedData;
    166             //    this.initVector = initVector;
    167             //    return;
    168             //}
    169             Bruteforcing(pattern, encryptedData, initVector);
    170         }
    171 
    172         /* dirty workaround, because it could happen, that a Worker
    173          * wants to start Bruteforcing before all Master Controls of the base
    174          * KeySearcber (IEncryptionControl und ICostControl) are finally
    175          * initialized, in this case the pattern will be stored and processed
    176          * after this event was thrown. */
    177         //private void keySearcher_OnAllMasterControlsInitialized()
    178         //{
    179         //    this.allMasterControlsInitialized = true;
    180         //    if (this.tryBruteforcingBeforeMastersInitialized)
    181         //    {
    182         //        Bruteforcing(this.actualKeyPattern, this.encryptedData, this.initVector);
    183         //        this.actualKeyPattern = null;
    184         //        this.encryptedData = null;
    185         //        this.initVector = null;
    186 
    187         //        this.tryBruteforcingBeforeMastersInitialized = false;
    188         //    }
    189         //}
    190 
    191         private void Bruteforcing(KeyPattern actualKeyPattern, byte[] encryptedData, byte[] initVector)
    192         {
    193136            //because the KeySearcher object uses this property instead of the parameters in some internal methods... Dirty implementation...
    194             this.keySearcher.Pattern = actualKeyPattern;
     137            this.keySearcher.Pattern = pattern;
    195138            //necessary, because the Pattern property seems to work incorrect
    196             this.keySearcher.Pattern.WildcardKey = actualKeyPattern.WildcardKey;
     139            this.keySearcher.Pattern.WildcardKey = pattern.WildcardKey;
    197140
    198141            //New stuff because of changing the IControl data flow - Arnie 2010.01.18
    199142
    200             this.keySearcher.BruteforcePattern(actualKeyPattern, encryptedData, initVector, this.keySearcher.ControlMaster, this.keySearcher.CostMaster);
     143            this.keySearcher.BruteforcePattern(pattern, encryptedData, initVector, this.keySearcher.ControlMaster, this.keySearcher.CostMaster);
    201144        }
    202145
Note: See TracChangeset for help on using the changeset viewer.