Use Apple's CCRandomGenerateBytes in GetCryptographicallySecureRandomBytes #51526
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Apple API offers significant performance improvements (an order of magnitude) over reading from /dev/urandom.
Closes #50897
BenchmarkDotNet=v0.12.1.20210419-develop, OS=macOS Big Sur 11.2.3 (20D91) [Darwin 20.3.0]
Intel Core i7-8700B CPU 3.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK=6.0.100-preview.3.21202.5
[Host] : .NET 6.0.0 (6.0.21.20104), X64 RyuJIT
Job-JBYKHU : .NET 6.0.0 (42.42.42.42424), X64 RyuJIT
Job-LIKOBM : .NET 6.0.0 (42.42.42.42424), X64 RyuJIT
Benchmark code is available at https://github.com/vcsjones/DotNetCryptoBenches/blob/610b5b2c9865e9fa27b7834ce0dcd0666d776e4d/src/RngBench.cs
/cc @GrabYourPitchforks @jkotas