From c5ca516583831091a5659e723db56a689b13be13 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Fri, 26 Apr 2024 12:45:45 -0400 Subject: [PATCH] Fix regression in RegexGenerator.GetSHA256FieldName (#101606) A previous refactoring deleted the use of the hash. --- .../gen/RegexGenerator.Emitter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs index b2ab52c4c71fa..0a6cb3212cb2f 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs +++ b/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs @@ -5405,7 +5405,7 @@ private static string GetSHA256FieldName(string prefix, string toEncode) { #pragma warning disable CA1850 // SHA256.HashData isn't available on netstandard2.0 using SHA256 sha = SHA256.Create(); - return $"{prefix}{ToHexStringNoDashes(Encoding.UTF8.GetBytes(toEncode))}"; + return $"{prefix}{ToHexStringNoDashes(sha.ComputeHash(Encoding.UTF8.GetBytes(toEncode)))}"; #pragma warning restore CA1850 }