From c6acb967e9657080df5cd9ec434323f0b4a6b2df Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 8 Aug 2021 19:53:08 +0700 Subject: Add missing GetHashCode variant --- crypto/src/util/Arrays.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crypto') diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index fdf08a90c..86848af8d 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -362,6 +362,24 @@ namespace Org.BouncyCastle.Utilities return hc; } + [CLSCompliantAttribute(false)] + public static int GetHashCode(ushort[] data) + { + if (data == null) + return 0; + + int i = data.Length; + int hc = i + 1; + + while (--i >= 0) + { + hc *= 257; + hc ^= data[i]; + } + + return hc; + } + public static int GetHashCode(int[] data, int off, int len) { if (data == null) -- cgit 1.5.1