using System; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; namespace D04._1 { class Program { static byte[] ToB(string str) => Encoding.ASCII.GetBytes(str); static string ToS(byte[] b) => BitConverter.ToString(b).Replace("-", ""); static void Main(string[] args) { if (args.Length < 1) throw new ArgumentException(); string hash = args[0]; int nbr = 0; using (var md5 = MD5.Create()) { do { var h = md5.ComputeHash(ToB($"{hash}{nbr}")); if (ToS(h).StartsWith("00000")) break; nbr++; } while (true); } Console.WriteLine($"Answer is : {nbr}"); } } }