Class BigInteger
- Namespace
- Org.BouncyCastle.Math
- Assembly
- BouncyCastle.Cryptography.dll
[Serializable]
public sealed class BigInteger : IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
- Inheritance
-
BigInteger
- Implements
- Inherited Members
Constructors
BigInteger(byte[])
public BigInteger(byte[] bytes)
Parameters
bytesbyte[]
BigInteger(byte[], bool)
public BigInteger(byte[] bytes, bool bigEndian)
Parameters
BigInteger(byte[], int, int)
public BigInteger(byte[] bytes, int offset, int length)
Parameters
BigInteger(byte[], int, int, bool)
public BigInteger(byte[] bytes, int offset, int length, bool bigEndian)
Parameters
BigInteger(int, byte[])
public BigInteger(int sign, byte[] bytes)
Parameters
BigInteger(int, byte[], bool)
public BigInteger(int sign, byte[] bytes, bool bigEndian)
Parameters
BigInteger(int, byte[], int, int)
public BigInteger(int sign, byte[] bytes, int offset, int length)
Parameters
BigInteger(int, byte[], int, int, bool)
public BigInteger(int sign, byte[] bytes, int offset, int length, bool bigEndian)
Parameters
BigInteger(int, int, Random)
public BigInteger(int bitLength, int certainty, Random random)
Parameters
BigInteger(int, Random)
public BigInteger(int sizeInBits, Random random)
Parameters
BigInteger(int, ReadOnlySpan<byte>)
public BigInteger(int sign, ReadOnlySpan<byte> bytes)
Parameters
signintbytesReadOnlySpan<byte>
BigInteger(int, ReadOnlySpan<byte>, bool)
public BigInteger(int sign, ReadOnlySpan<byte> bytes, bool bigEndian)
Parameters
signintbytesReadOnlySpan<byte>bigEndianbool
BigInteger(string)
public BigInteger(string value)
Parameters
valuestring
BigInteger(string, int)
public BigInteger(string str, int radix)
Parameters
Fields
Five
public static readonly BigInteger Five
Field Value
Four
public static readonly BigInteger Four
Field Value
One
public static readonly BigInteger One
Field Value
Six
public static readonly BigInteger Six
Field Value
Ten
public static readonly BigInteger Ten
Field Value
Three
public static readonly BigInteger Three
Field Value
Two
public static readonly BigInteger Two
Field Value
Zero
public static readonly BigInteger Zero
Field Value
Properties
BitCount
public int BitCount { get; }
Property Value
BitLength
public int BitLength { get; }
Property Value
IntValue
public int IntValue { get; }
Property Value
IntValueExact
public int IntValueExact { get; }
Property Value
LongValue
public long LongValue { get; }
Property Value
LongValueExact
public long LongValueExact { get; }
Property Value
SignValue
public int SignValue { get; }
Property Value
Methods
Abs()
public BigInteger Abs()
Returns
Add(BigInteger)
public BigInteger Add(BigInteger value)
Parameters
valueBigInteger
Returns
And(BigInteger)
public BigInteger And(BigInteger value)
Parameters
valueBigInteger
Returns
AndNot(BigInteger)
public BigInteger AndNot(BigInteger val)
Parameters
valBigInteger
Returns
Arbitrary(int)
public static BigInteger Arbitrary(int sizeInBits)
Parameters
sizeInBitsint
Returns
ClearBit(int)
public BigInteger ClearBit(int n)
Parameters
nint
Returns
CompareTo(BigInteger)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(BigInteger other)
Parameters
otherBigIntegerAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
CompareTo(object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
Divide(BigInteger)
public BigInteger Divide(BigInteger val)
Parameters
valBigInteger
Returns
DivideAndRemainder(BigInteger)
public BigInteger[] DivideAndRemainder(BigInteger val)
Parameters
valBigInteger
Returns
Equals(BigInteger)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(BigInteger other)
Parameters
otherBigIntegerAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
FlipBit(int)
public BigInteger FlipBit(int n)
Parameters
nint
Returns
Gcd(BigInteger)
public BigInteger Gcd(BigInteger value)
Parameters
valueBigInteger
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetLengthofByteArray()
public int GetLengthofByteArray()
Returns
GetLengthofByteArrayUnsigned()
public int GetLengthofByteArrayUnsigned()
Returns
GetLengthofUInt32Array()
public int GetLengthofUInt32Array()
Returns
GetLengthofUInt32ArrayUnsigned()
public int GetLengthofUInt32ArrayUnsigned()
Returns
GetLowestSetBit()
public int GetLowestSetBit()
Returns
IsProbablePrime(int)
public bool IsProbablePrime(int certainty)
Parameters
certaintyint
Returns
Max(BigInteger)
public BigInteger Max(BigInteger value)
Parameters
valueBigInteger
Returns
Min(BigInteger)
public BigInteger Min(BigInteger value)
Parameters
valueBigInteger
Returns
Mod(BigInteger)
public BigInteger Mod(BigInteger m)
Parameters
Returns
ModDivide(BigInteger, BigInteger)
public BigInteger ModDivide(BigInteger y, BigInteger m)
Parameters
yBigIntegermBigInteger
Returns
ModInverse(BigInteger)
public BigInteger ModInverse(BigInteger m)
Parameters
Returns
ModMultiply(BigInteger, BigInteger)
public BigInteger ModMultiply(BigInteger y, BigInteger m)
Parameters
yBigIntegermBigInteger
Returns
ModPow(BigInteger, BigInteger)
public BigInteger ModPow(BigInteger e, BigInteger m)
Parameters
eBigIntegermBigInteger
Returns
ModSquare(BigInteger)
public BigInteger ModSquare(BigInteger m)
Parameters
Returns
Multiply(BigInteger)
public BigInteger Multiply(BigInteger val)
Parameters
valBigInteger
Returns
Negate()
public BigInteger Negate()
Returns
NextProbablePrime()
public BigInteger NextProbablePrime()
Returns
Not()
public BigInteger Not()
Returns
Or(BigInteger)
public BigInteger Or(BigInteger value)
Parameters
valueBigInteger
Returns
Pow(int)
public BigInteger Pow(int exp)
Parameters
expint
Returns
ProbablePrime(int, Random)
public static BigInteger ProbablePrime(int bitLength, Random random)
Parameters
Returns
RabinMillerTest(int, Random)
public bool RabinMillerTest(int certainty, Random random)
Parameters
Returns
Remainder(BigInteger)
public BigInteger Remainder(BigInteger n)
Parameters
Returns
SetBit(int)
public BigInteger SetBit(int n)
Parameters
nint
Returns
ShiftLeft(int)
public BigInteger ShiftLeft(int n)
Parameters
nint
Returns
ShiftRight(int)
public BigInteger ShiftRight(int n)
Parameters
nint
Returns
Square()
public BigInteger Square()
Returns
Subtract(BigInteger)
public BigInteger Subtract(BigInteger n)
Parameters
Returns
TestBit(int)
public bool TestBit(int n)
Parameters
nint
Returns
ToByteArray()
public byte[] ToByteArray()
Returns
- byte[]
ToByteArray(Span<byte>)
public void ToByteArray(Span<byte> output)
Parameters
ToByteArrayUnsigned()
public byte[] ToByteArrayUnsigned()
Returns
- byte[]
ToByteArrayUnsigned(Span<byte>)
public void ToByteArrayUnsigned(Span<byte> output)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(int)
public string ToString(int radix)
Parameters
radixint
Returns
ToUInt32ArrayBigEndian(Span<uint>)
[CLSCompliant(false)]
public void ToUInt32ArrayBigEndian(Span<uint> output)
Parameters
ToUInt32ArrayBigEndianUnsigned(Span<uint>)
[CLSCompliant(false)]
public void ToUInt32ArrayBigEndianUnsigned(Span<uint> output)
Parameters
ToUInt32ArrayLittleEndian(Span<uint>)
[CLSCompliant(false)]
public void ToUInt32ArrayLittleEndian(Span<uint> output)
Parameters
ToUInt32ArrayLittleEndianUnsigned(Span<uint>)
[CLSCompliant(false)]
public void ToUInt32ArrayLittleEndianUnsigned(Span<uint> output)
Parameters
ValueOf(int)
public static BigInteger ValueOf(int value)
Parameters
valueint
Returns
ValueOf(long)
public static BigInteger ValueOf(long value)
Parameters
valuelong
Returns
Xor(BigInteger)
public BigInteger Xor(BigInteger value)
Parameters
valueBigInteger