Use same-algorithm factories for closed streaming hash fields
ProprietaryOpt-in modern-.NET replacement of known parameterless MD5 CSP or SHA Managed/CSP initializers on private non-readonly same-algorithm base-typed fields with no other writes. Require all field references to be its declaration, BCL ComputeHash/TransformBlock/TransformFinalBlock receivers or Hash/HashSize reads, with a final transform and state read present. Retain the field type/name/symbol, streaming calls, buffer copies, arguments, allocation site and lifetime. Leave resets, cleanup/configuration/identity operations, escapes, unsupported owners/imports, lambdas/queries and snapshots unchanged. Stream subclasses are eligible; no remoting, provider/FIPS/reflection/serialization or concurrency-policy emulation. No new cleanup or algorithm strengthening; standalone, not in version composites.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseFactoryForClosedStreamingHashFieldsmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseFactoryForClosedStreamingHashFieldsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.