summary refs log tree commit diff
path: root/crypto/src/util/BigIntegers.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-10-14 19:40:02 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-10-14 19:40:02 +0700
commit94173c7f8b2d87b28353b7e9ee8d0f2514f02875 (patch)
treebee9c940b4ada80b23e316386e64a945290d8306 /crypto/src/util/BigIntegers.cs
parentMove XDH/EdDSA key generation into low-level (diff)
downloadBouncyCastle.NET-ed25519-94173c7f8b2d87b28353b7e9ee8d0f2514f02875.tar.xz
Port of CVC-ECDSA and PLAIN-ECDSA from Java
Diffstat (limited to '')
-rw-r--r--crypto/src/util/BigIntegers.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/src/util/BigIntegers.cs b/crypto/src/util/BigIntegers.cs
index f2d0425cc..df78d1d86 100644
--- a/crypto/src/util/BigIntegers.cs
+++ b/crypto/src/util/BigIntegers.cs
@@ -86,5 +86,10 @@ namespace Org.BouncyCastle.Utilities
             // fall back to a faster (restricted) method
             return new BigInteger(max.Subtract(min).BitLength - 1, random).Add(min);
         }
+
+        public static int GetUnsignedByteLength(BigInteger n)
+        {
+            return (n.BitLength + 7) / 8;
+        }
     }
 }