Ignore:
Timestamp:
May 17, 2010, 11:31:23 AM (11 years ago)
Author:
pretzsch
Message:

MD5Collider: Added comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/MD5Collider/Algorithm/MultiThreadedMD5Collider.cs

    r1356 r1430  
    88namespace Cryptool.Plugins.MD5Collider.Algorithm
    99{
     10    /// <summary>
     11    /// Wraps an existing <c>IMD5ColliderAlgorithm</c> implementation to execute it in parallel using multiple threads
     12    /// </summary>
     13    /// <typeparam name="T">Type of collider to run in parallel</typeparam>
    1014    class MultiThreadedMD5Collider<T> : IMD5ColliderAlgorithm where T : IMD5ColliderAlgorithm, new()
    1115    {
     16        /// <summary>
     17        /// A list of <c>ColliderWorkerAdapter</c> which manage the threads for the collider instances
     18        /// </summary>
     19        /// <seealso cref="ColliderWorkerAdapter"/>
    1220        private List<ColliderWorkerAdapter<T>> workers = new List<ColliderWorkerAdapter<T>>();
     21
     22        /// <summary>
     23        /// The managed container instances
     24        /// </summary>
    1325        private List<IMD5ColliderAlgorithm> colliders = new List<IMD5ColliderAlgorithm>();
     26
     27        /// <summary>
     28        /// The collider which finished first
     29        /// </summary>
    1430        private IMD5ColliderAlgorithm successfulCollider;
     31
     32        /// <summary>
     33        /// Timer periodically emitting <c>PropertyChanged</c> events for progress notification properties
     34        /// </summary>
    1535        private Timer progressUpdateTimer;
     36
     37        /// <summary>
     38        /// Amount of worker threads managed
     39        /// </summary>
    1640        private int workerCount;
    1741
     42        /// <summary>
     43        /// Event triggered when the first collision has finished
     44        /// </summary>
    1845        private System.Threading.AutoResetEvent finishedEvent = new System.Threading.AutoResetEvent(false);
    1946
     47        /// <summary>
     48        /// Constructs as many managed colliders and worker threads as CPU cores are available and sets up the timer
     49        /// </summary>
    2050        public MultiThreadedMD5Collider()
    2151        {
     
    3666        }
    3767
     68        /// <summary>
     69        /// First resulting block as retrieved from finished collider
     70        /// </summary>
    3871        public byte[] FirstCollidingData { get { return successfulCollider != null ? successfulCollider.FirstCollidingData : null; } }
     72
     73        /// <summary>
     74        /// Second resulting block as retrieved from finished collider
     75        /// </summary>
    3976        public byte[] SecondCollidingData { get { return successfulCollider != null ? successfulCollider.SecondCollidingData : null; } }
    4077
     78        /// <summary>
     79        /// Second resulting block as retrieved from finished collider
     80        /// </summary>
    4181        public byte[] RandomSeed
    4282        {
     
    67107        }
    68108
     109        /// <summary>
     110        /// Mutex locked when a computation has finished
     111        /// </summary>
    69112        private Object finishedLock = new Object();
    70113
     114        /// <summary>
     115        /// Called by a <c>ColliderWorkerAdapter</c> when wrapped collider has finished
     116        /// </summary>
     117        /// <param name="successfulCollider"></param>
    71118        internal void SignalWorkIsFinished(IMD5ColliderAlgorithm successfulCollider)
    72119        {
     
    83130            }
    84131        }
    85 
     132       
     133        /// <summary>
     134        /// IHV (intermediate hash value) for the start of the collision, must be initialized if prefix is desired
     135        /// </summary>
    86136        public byte[] IHV
    87137        {
     
    93143        }
    94144
     145        /// <summary>
     146        /// Maximum possible value for match progress
     147        /// </summary>
    95148        public int MatchProgressMax
    96149        {
     
    98151        }
    99152
     153        /// <summary>
     154        /// Indicates how far conditions for a valid collision block were satisfied in last attempt
     155        /// </summary>
    100156        public int MatchProgress
    101157        {
     
    104160        }
    105161
     162        /// <summary>
     163        /// Number of conditions which have failed
     164        /// </summary>
    106165        public long CombinationsTried
    107166        {
     
    109168        }
    110169
     170        /// <summary>
     171        /// Time elapsed since start of collision search
     172        /// </summary>
    111173        public TimeSpan ElapsedTime
    112174        {
     
    114176        }
    115177
     178        /// <summary>
     179        /// Starts the collision search
     180        /// </summary>
    116181        public void FindCollision()
    117182        {
     
    130195        }
    131196
     197        /// <summary>
     198        /// Stops the collision search
     199        /// </summary>
    132200        public void Stop()
    133201        {
     
    138206        }
    139207
     208        /// <summary>
     209        /// The <c>PropertyChanged</c> event as prescribed by the <c>INotifyPropertyChanged</c> interface
     210        /// </summary>
    140211        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     212
     213        /// <summary>
     214        /// Helper function triggering <c>PropertyChanged</c> event for given property name
     215        /// </summary>
     216        /// <param name="propertyName">Property for which change event should be triggerd</param>
    141217        private void OnPropertyChanged(string propertyName)
    142218        {
Note: See TracChangeset for help on using the changeset viewer.