summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-08-08 19:53:08 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-08-08 19:53:08 +0700
commitc6acb967e9657080df5cd9ec434323f0b4a6b2df (patch)
treef1094760287768bba38c1a92fed795d89cfdef55
parentCleanup after bc-fips-csharp updates (diff)
downloadBouncyCastle.NET-ed25519-c6acb967e9657080df5cd9ec434323f0b4a6b2df.tar.xz
Add missing GetHashCode variant
-rw-r--r--crypto/src/util/Arrays.cs18
1 files changed, 18 insertions, 0 deletions
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)