summary refs log tree commit diff
path: root/crypto/src/math/BigInteger.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-17 00:32:42 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-17 00:32:42 +0700
commit53a114b1704b0833c2d99c8d0e4ba4fcb6ed09c1 (patch)
tree36d10593bc4b21a9841b6747d81c2eecfa7217e6 /crypto/src/math/BigInteger.cs
parentEdDSA improvements (diff)
downloadBouncyCastle.NET-ed25519-53a114b1704b0833c2d99c8d0e4ba4fcb6ed09c1.tar.xz
BigInteger implements IComparable
Diffstat (limited to 'crypto/src/math/BigInteger.cs')
-rw-r--r--crypto/src/math/BigInteger.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs
index c8581775d..5b2ea0d87 100644
--- a/crypto/src/math/BigInteger.cs
+++ b/crypto/src/math/BigInteger.cs
@@ -16,7 +16,7 @@ namespace Org.BouncyCastle.Math
 {
     [Serializable]
     public sealed class BigInteger
-        : IComparable<BigInteger>, IEquatable<BigInteger>
+        : IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
     {
         // The first few odd primes
         /*
@@ -1051,6 +1051,17 @@ namespace Org.BouncyCastle.Math
             return sign > 0 && nBits == 1;
         }
 
+        public int CompareTo(object obj)
+        {
+            if (obj == null)
+                return 1;
+
+            if (!(obj is BigInteger other))
+                throw new ArgumentException("Object is not a BigInteger", nameof(obj));
+
+            return CompareTo(other);
+        }
+
         public int CompareTo(BigInteger other)
         {
             if (other == null)