void Main() { Parallel.For(0, 9999999, (pin, loop) => { using(var sha1 = new SHA1Cng()) using(var sha256 = new SHA256Cng()) using(var md5 = new MD5Cng()) { byte[] data = Encoding.ASCII.GetBytes(pin.ToString("D7")); if (GetHexResult(data, sha1).Substring(0, 2) == "F1" && GetHexResult(data, sha256).Substring(30, 2) == "91" && GetHexResult(data, md5).Substring(30, 2) == "5A") { pin.ToString("D7").Dump(); loop.Stop(); } } }); } // Define other methods and classes here public static string GetHexResult(byte[] data, HashAlgorithm algorithm) { return algorithm.ComputeHash(data).ToHexString(); } public static class MyExtensions { // Write custom extension methods here. They will be available to all queries. // Source: http://stackoverflow.com/a/14333437 public static string ToHexString(this byte[] bytes) { if (bytes == null) { throw new ArgumentNullException("bytes", "The byte array was null."); } int b; char[] chars = new char[bytes.Length * 2]; for (int i = 0; i < bytes.Length; i++) { b = bytes[i] >> 4; chars[i * 2] = (char)(55 + b + (((b - 10) >> 31) & -7)); b = bytes[i] & 0xF; chars[i * 2 + 1] = (char)(55 + b + (((b - 10) >> 31) & -7)); } return new string(chars); } }