public static bool IsEqual(string s1, string s2) { if (s1 == null && s2 == null) { return(true); } if (s1 == null || s2 == null) { return(false); } if (s1.Length != s2.Length) { return(false); } var s1chars = s1.ToCharArray(); var s2chars = s2.ToCharArray(); int hits = 0; for (int i = 0; i < s1.Length; i++) { if (s1chars[i].Equals(s2chars[i])) { hits += 2; } else { hits += 1; } } bool same = (hits == s1.Length * 2); var rnd = new CryptoRandom(); Thread.Sleep(rnd.Next(0, 10)); return(same); }
public static bool IsEqual(string s1, string s2) { if (s1 == null && s2 == null) { return true; } if (s1 == null || s2 == null) { return false; } if (s1.Length != s2.Length) { return false; } var s1chars = s1.ToCharArray(); var s2chars = s2.ToCharArray(); int hits = 0; for (int i = 0; i < s1.Length; i++) { if (s1chars[i].Equals(s2chars[i])) { hits += 2; } else { hits += 1; } } bool same = (hits == s1.Length * 2); var rnd = new CryptoRandom(); Thread.Sleep(rnd.Next(0, 10)); return same; }