90 lines
2.7 KiB
C#
90 lines
2.7 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities
|
|
{
|
|
// Token: 0x02001A01 RID: 6657
|
|
[Token(Token = "0x2001A01")]
|
|
public abstract class BigIntegers
|
|
{
|
|
// Token: 0x06009C10 RID: 39952 RVA: 0x001FEE80 File Offset: 0x001FD080
|
|
[Token(Token = "0x6009C10")]
|
|
[Address(RVA = "0x4DFDF0", Offset = "0x4DEDF0", VA = "0x1804DFDF0")]
|
|
public static byte[] AsUnsignedByteArray(BigInteger n)
|
|
{
|
|
return n.ToByteArrayUnsigned();
|
|
}
|
|
|
|
// Token: 0x06009C11 RID: 39953 RVA: 0x001FEE9C File Offset: 0x001FD09C
|
|
[Token(Token = "0x6009C11")]
|
|
[Address(RVA = "0x4DFE10", Offset = "0x4DEE10", VA = "0x1804DFE10")]
|
|
public static byte[] AsUnsignedByteArray(int length, BigInteger n)
|
|
{
|
|
byte[] array = n.ToByteArrayUnsigned();
|
|
if (array.Length != length)
|
|
{
|
|
byte[] array2 = new byte[length];
|
|
int length2 = array.Length;
|
|
int num = array2.Length;
|
|
int num2 = 0;
|
|
num -= length2;
|
|
Array.Copy(array, num2, array2, num, length2);
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06009C12 RID: 39954 RVA: 0x001FEEE8 File Offset: 0x001FD0E8
|
|
[Token(Token = "0x6009C12")]
|
|
[Address(RVA = "0x4DFEE0", Offset = "0x4DEEE0", VA = "0x1804DFEE0")]
|
|
public static BigInteger CreateRandomInRange(BigInteger min, BigInteger max, SecureRandom random)
|
|
{
|
|
int num = min.CompareTo(max);
|
|
int num2 = min.BitLength;
|
|
int num3 = 0;
|
|
int num4 = max.BitLength;
|
|
num4 -= num3;
|
|
int num5 = 0;
|
|
num2 = max.BitLength;
|
|
BigInteger bigInteger = new BigInteger(num2, random);
|
|
int num6 = bigInteger.CompareTo(min);
|
|
if (bigInteger.CompareTo(max) > 0)
|
|
{
|
|
num5++;
|
|
num2 = max.Subtract(min).BitLength;
|
|
int num7;
|
|
BigInteger bigInteger2 = new BigInteger(num7, random);
|
|
num7 = num2 - 1;
|
|
return bigInteger2.Add(min);
|
|
}
|
|
BigInteger zero = BigInteger.Zero;
|
|
BigInteger bigInteger3 = max.Subtract(min);
|
|
BigInteger bigInteger4 = BigIntegers.CreateRandomInRange(zero, bigInteger3, random);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009C13 RID: 39955 RVA: 0x001FEF88 File Offset: 0x001FD188
|
|
[Token(Token = "0x6009C13")]
|
|
[Address(RVA = "0x4E00F0", Offset = "0x4DF0F0", VA = "0x1804E00F0")]
|
|
public static int GetUnsignedByteLength(BigInteger n)
|
|
{
|
|
int num = 0;
|
|
int num2 = n.BitLength;
|
|
num2 += 7;
|
|
return num2 + num;
|
|
}
|
|
|
|
// Token: 0x06009C14 RID: 39956 RVA: 0x001FEFB0 File Offset: 0x001FD1B0
|
|
[Token(Token = "0x6009C14")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
protected BigIntegers()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400689F RID: 26783
|
|
[Token(Token = "0x400689F")]
|
|
private const int MaxIterations = 1000;
|
|
}
|
|
}
|