Use the same hash factory for a local cleaned up in finally

Proprietary

Replace known parameterless MD5 CSP or SHA Managed/CSP plain-local construction with its same-algorithm factory when all references are BCL ComputeHash and direct cleanup calls in one top-level try/finally. Retain the original try/finally, cleanup order and lifetime. Reject hashing in or after the finally block, nested cleanup, labels/goto re-entry, state/reset/configuration, identity, escapes/captures, async/iterators and snapshots. Opt-in modern-.NET compatibility port; no algorithm, encoding or format change.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseFinallyCleanupHashLocalFactory
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseFinallyCleanupHashLocalFactory

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.