src/anagramsolver/services/Md5Helper.cs
/// <summary>
/// Check md5 against _md5Hashes.
/// Remove hash from list if found
/// If no hashes left in list return null
/// </summary>
/// <param name="input">string to check md5 on</param>
/// <returns>Did string match any of the hashes?</returns>
Check md5 against _md5Hashes.
Remove hash from list if found
If no hashes left in list return null
Check md5 against _md5Hashes . Remove hash from list if found If no hashes left in list return null
public bool? VerifyMd5HashRemoveHashIfFound(string input)
        {
            bool? result = null;
            if (_md5Hashes.Length > 0)
            {
                string hashOfInput = GetMd5Hash(_md5HashComputer, input);
                StringComparer comparer = StringComparer.OrdinalIgnoreCase;
                for (int i = 0; i < _md5Hashes.Length; i++)
                {
                    result = (0 == comparer.Compare(hashOfInput, _md5Hashes[i]));
                    if (result.HasValue && result.Value == true)
                    {
                        var hashList= new List<string>(_md5Hashes);
                        hashList.RemoveAt(i);
                        _md5Hashes = hashList.ToArray();
                        break;
                    }
                }
            }
            return result;
        }
public bool ? VerifyMd5HashRemoveHashIfFound ( string input ) { bool ? result = null ; if ( _md5Hashes . Length > 0 ) { string hashOfInput = GetMd5Hash ( _md5HashComputer , input ) ; StringComparer comparer = StringComparer . OrdinalIgnoreCase ; for ( int i = 0 ; i < _md5Hashes . Length ; i ++ ) { result = ( 0 == comparer . Compare ( hashOfInput , _md5Hashes [ i ] ) ) ; if ( result . HasValue && result . Value == true ) { var hashList = new List < string > ( _md5Hashes ) ; hashList . RemoveAt ( i ) ; _md5Hashes = hashList . ToArray ( ) ; break ; } } } return result ; }
Check md5 against _md5Hashes.
Check md5 against _md5Hashes .
// Hash the input. // Create a StringComparer an compare the hashes. // Check aginst each md5 string  // A correct sentence was found // Remove hash from list, so we won't have to check against it anymore
None
input
string
string to check md5 on
string to check md5 on