Skip to content

Conversation

@GrabYourPitchforks
Copy link
Member

Inspired by #40169 and #52373. This makes the implementation of RandomNumberGenerator.Create() return a singleton instance. So apps which need to call RandomNumberGenerator.Create() instead of using the static accelerator APIs can still take advantage of a non-allocating factory.

Attempting to dispose of the returned singleton instance will no-op. The implementation of RandomNumberGenerator.Create(string) is not changed. Using that API will continue to go through the normal CryptoConfig activation code paths.

/cc @jeffhandley

@ghost
Copy link

ghost commented May 8, 2021

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks
See info in area-owners.md if you want to be subscribed.

Issue Details

Inspired by #40169 and #52373. This makes the implementation of RandomNumberGenerator.Create() return a singleton instance. So apps which need to call RandomNumberGenerator.Create() instead of using the static accelerator APIs can still take advantage of a non-allocating factory.

Attempting to dispose of the returned singleton instance will no-op. The implementation of RandomNumberGenerator.Create(string) is not changed. Using that API will continue to go through the normal CryptoConfig activation code paths.

/cc @jeffhandley

Author: GrabYourPitchforks
Assignees: -
Labels:

area-System.Security

Milestone: 6.0.0

@bartonjs bartonjs merged commit abd9c96 into dotnet:main May 11, 2021
@GrabYourPitchforks GrabYourPitchforks deleted the prng branch May 11, 2021 17:50
Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@ghost ghost locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants