Skip to content

Call SHA1.HashData static helper instead of instantiating SHA1CSP#3318

Merged
ryalanms merged 1 commit intodotnet:masterfrom
GrabYourPitchforks:upd_crypto_dev
Jan 7, 2021
Merged

Call SHA1.HashData static helper instead of instantiating SHA1CSP#3318
ryalanms merged 1 commit intodotnet:masterfrom
GrabYourPitchforks:upd_crypto_dev

Conversation

@GrabYourPitchforks
Copy link
Member

We're trying to minimize usage of the *CryptoServiceProvider and *Managed types through our code bases so that we can eventually write analyzers to recommend moving off of them. See dotnet/runtime#40169 for some related discussion w.r.t. RNGCryptoServiceProvider.

This PR changes the call site to use the static one-shot helper method so that you don't need to instantiate a hasher object. The HashData static method uses the best available implementation for the current OS.

@GrabYourPitchforks GrabYourPitchforks requested a review from a team as a code owner August 8, 2020 01:27
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Aug 8, 2020
@ghost ghost requested review from SamBent, fabiant3 and ryalanms August 8, 2020 01:27
@reflectronic
Copy link

reflectronic commented Aug 26, 2020

This code is actually copied from C#/WinRT. Once the support for WinRT interop flows into the SDK in a way that WPF can consume, this file is supposed to be removed. You may want to submit this fix to the C#/WinRT repo instead.

@ryalanms
Copy link
Member

ryalanms commented Jan 7, 2021

Thanks, @GrabYourPitchforks.

@ryalanms ryalanms merged commit 03c2dfd into dotnet:master Jan 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants