diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-02 22:53:02 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-02 22:53:02 +0700 |
commit | 8cc2da3a37a777927f9d683b0b57bfffcc8195c9 (patch) | |
tree | 193f6a67b2fd4a0d7f846a0fbccbea64bbeceed9 /crypto/src/util | |
parent | Fix obsolete usage (diff) | |
download | BouncyCastle.NET-ed25519-8cc2da3a37a777927f9d683b0b57bfffcc8195c9.tar.xz |
BIKE refactoring
Diffstat (limited to '')
-rw-r--r-- | crypto/src/util/Arrays.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index a9ae6724a..da74d467a 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -97,6 +97,24 @@ namespace Org.BouncyCastle.Utilities return true; } + [CLSCompliant(false)] + public static bool AreEqual(ulong[] a, int aFromIndex, int aToIndex, ulong[] b, int bFromIndex, int bToIndex) + { + int aLength = aToIndex - aFromIndex; + int bLength = bToIndex - bFromIndex; + + if (aLength != bLength) + return false; + + for (int i = 0; i < aLength; ++i) + { + if (a[aFromIndex + i] != b[bFromIndex + i]) + return false; + } + + return true; + } + [Obsolete("Use 'FixedTimeEquals' instead")] public static bool ConstantTimeAreEqual(byte[] a, byte[] b) { |