예제 #1
0
        static void day4(int part = 1)
        {
            decimal i   = 0;
            MD5Cng  md5 = new MD5Cng();

            md5.Initialize();
            string hash;

            while (true)
            {
                hash = ByteArrayToString(md5.ComputeHash(Encoding.ASCII.GetBytes("iwrupvqb" + i.ToString())));
                if (part == 1)
                {
                    if (hash.StartsWith("00000"))
                    {
                        break;
                    }
                }
                else
                {
                    if (hash.StartsWith("000000"))
                    {
                        break;
                    }
                }
                ++i;
            }
            System.Console.WriteLine(hash + " | " + i);
        }