From 071fe7ce868a63113143b949c3c4185f9e5578cf Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Fri, 9 Sep 2022 11:35:58 -0400 Subject: [PATCH] Use HashCode.AddBytes in CodeHeaderValue.GetHashCode --- .../src/System/Security/Cryptography/Cose/CoseHeaderValue.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs b/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs index dffda0904c90b..4602f2295cfd0 100644 --- a/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs +++ b/src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseHeaderValue.cs @@ -261,10 +261,14 @@ public int GetValueAsBytes(Span destination) public override int GetHashCode() { HashCode hashCode = default; +#if NET + hashCode.AddBytes(EncodedValue.Span); +#else foreach (byte b in EncodedValue.Span) { hashCode.Add(b); } +#endif return hashCode.ToHashCode(); }