diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/CacheTagKey.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/CacheTagKey.cs
index 3abaea6627..f46295d3de 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/CacheTagKey.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/Cache/CacheTagKey.cs
@@ -6,6 +6,7 @@
using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.TagHelpers.Internal;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Internal;
@@ -151,10 +152,10 @@ public string GenerateHashedKey()
// The key is typically too long to be useful, so we use a cryptographic hash
// as the actual key (better randomization and key distribution, so small vary
// values will generate dramatically different keys).
- using (var sha = SHA256.Create())
+ using (var sha256 = CryptographyAlgorithms.CreateSHA256())
{
var contentBytes = Encoding.UTF8.GetBytes(key);
- var hashedBytes = sha.ComputeHash(contentBytes);
+ var hashedBytes = sha256.ComputeHash(contentBytes);
return Convert.ToBase64String(hashedBytes);
}
}
@@ -183,14 +184,14 @@ public bool Equals(CacheTagKey other)
AreSame(_headers, other._headers) &&
AreSame(_queries, other._queries) &&
AreSame(_routeValues, other._routeValues) &&
- _varyByUser == other._varyByUser &&
+ _varyByUser == other._varyByUser &&
(!_varyByUser || string.Equals(other._username, _username, StringComparison.Ordinal));
}
///
public override int GetHashCode()
{
- // The hashcode is intentionally not using the computed
+ // The hashcode is intentionally not using the computed
// stringified key in order to prevent string allocations
// in the common case where it's not explicitly required.
@@ -219,7 +220,7 @@ public override int GetHashCode()
return _hashcode.Value;
}
-
+
private static IList> ExtractCollection(string keys, TSourceCollection collection, Func accessor)
{
if (string.IsNullOrEmpty(keys))
@@ -244,7 +245,7 @@ private static IList> ExtractCollection