public static StorageOfData StartProofOfWork(string testData, int startingZeros)
        {
            var resultData = new StorageOfData();

            // startingZeros - number of starting zero bits resulting SHA256 block hash should contain

            var expectedResult = new string('0', startingZeros);

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            resultData.HashData = string.Empty;
            while (true)
            {
                if (stopwatch.Elapsed.TotalSeconds > 300)
                {
                    MessageBox.Show("Too hard to find hash with that count of zero bits");
                    break;
                }
                if ((!resultData.HashData.StartsWith(expectedResult)))
                {
                    resultData.NumberOfIterations++;
                    resultData.Data     = testData + RandomStringGenerator.GenerateByLen(10);
                    resultData.HashData = HashOperations.GenerateSha256String(resultData.Data);
                    resultData.Time     = stopwatch.Elapsed.TotalSeconds;
                }
                else
                {
                    break;
                }
            }
            resultData.Time = stopwatch.Elapsed.TotalSeconds;
            return(resultData);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int numberOfSolutionsFound = 0;
            var storage     = new StorageOfData();
            var proofOfWork = new ProofOfWork();

            storage.Time = 0;
            // Get startingZeros from checkboxes
            // 8 by default
            var startingZeros = 2;

            if (eightCheckBox.IsChecked.Value)
            {
                // 8 zero bits
                startingZeros = 2;
            }
            if (sixteenCheckBox.IsChecked.Value)
            {
                // 16 zero bits
                startingZeros = 4;
            }
            if (thirtyTwoCheckBox.IsChecked.Value)
            {
                // 32 zero bits
                startingZeros = 8;
            }

            while (storage.Time < Int32.Parse(timeForProcessTxt.Text))
            {
                var result = ProofOfWork.StartProofOfWork("Alice", startingZeros);
                storage.Time += result.Time;
                numberOfSolutionsFound++;
                // store data in bin\Debug
                StreamWriter sw = File.AppendText(Environment.CurrentDirectory + @"\dataStorage.txt");
                using (sw)
                {
                    sw.WriteLine($"Numbers of iteration: {result.NumberOfIterations}, String: {result.Data}, Hash: {result.HashData}");
                }
            }
            MessageBox.Show($"Check your file:D");
        }