Exemplo n.º 1
0
        private async Task FuzzEntropySource(int iterations, IEntropySource source, string filename, Action extra)
        {
            using (var sw = new StreamWriter(filename + ".txt", false, Encoding.UTF8))
            {
                await sw.WriteLineAsync($"{source.GetType().FullName} - {iterations:N0} iterations");

                for (int i = 0; i < iterations; i++)
                {
                    var bytes = await source.GetEntropyAsync(EntropyPriority.High);

                    if (bytes == null)
                    {
                        await sw.WriteLineAsync("<null>");
                    }
                    else
                    {
                        await sw.WriteLineAsync(bytes.ToHexString());
                    }
                    extra();
                }
            }
        }