Use same-algorithm factories for closed readonly hash fields
ProprietaryOpt-in modern-.NET port of explicit private readonly MD5 CSP or SHA Managed/CSP fields whose only source uses are known parameterless allocations and BCL ComputeHash calls. Retain allocation sites, shared instance reuse, calls/arguments and lifetime; replace the private concrete field with a collision-safe same-algorithm base-typed field and factory calls. Require all references to qualify. Leave mutation/configuration, state/cleanup/identity operations, escapes, exposed fields, attributes, partial/generic/proxy/serializable owners, lambdas/queries and snapshots unchanged. Provider identity, private-field reflection/serialization, platform/FIPS policy and implementation-specific behavior are not emulated. No algorithm strengthening or new cleanup policy.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseFactoriesForClosedReadonlyHashFieldsmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseFactoriesForClosedReadonlyHashFieldsInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.