2 files changed, 13 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs
index a9a574dbf..4a8c65e88 100644
--- a/crypto/src/util/Arrays.cs
+++ b/crypto/src/util/Arrays.cs
@@ -469,6 +469,14 @@ namespace Org.BouncyCastle.Utilities
}
}
+ public static void Fill(byte[] buf, int from, int to, byte b)
+ {
+ for (int i = from; i < to; ++i)
+ {
+ buf[i] = b;
+ }
+ }
+
public static byte[] CopyOf(byte[] data, int newLength)
{
byte[] tmp = new byte[newLength];
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;
+ }
}
}
|