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: 0x02001921 RID: 6433
|
|
[Token(Token = "0x2001921")]
|
|
public abstract class BigIntegers
|
|
{
|
|
// Token: 0x06009842 RID: 38978 RVA: 0x001F5DE8 File Offset: 0x001F3FE8
|
|
[Token(Token = "0x6009842")]
|
|
[Address(RVA = "0x18D62E0", Offset = "0x18D50E0", VA = "0x1818D62E0")]
|
|
public static byte[] AsUnsignedByteArray(BigInteger n)
|
|
{
|
|
return n.ToByteArrayUnsigned();
|
|
}
|
|
|
|
// Token: 0x06009843 RID: 38979 RVA: 0x001F5E04 File Offset: 0x001F4004
|
|
[Token(Token = "0x6009843")]
|
|
[Address(RVA = "0x18D6300", Offset = "0x18D5100", VA = "0x1818D6300")]
|
|
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: 0x06009844 RID: 38980 RVA: 0x001F5E50 File Offset: 0x001F4050
|
|
[Token(Token = "0x6009844")]
|
|
[Address(RVA = "0x18D63D0", Offset = "0x18D51D0", VA = "0x1818D63D0")]
|
|
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: 0x06009845 RID: 38981 RVA: 0x001F5EF0 File Offset: 0x001F40F0
|
|
[Token(Token = "0x6009845")]
|
|
[Address(RVA = "0x18D65E0", Offset = "0x18D53E0", VA = "0x1818D65E0")]
|
|
public static int GetUnsignedByteLength(BigInteger n)
|
|
{
|
|
int num = 0;
|
|
int num2 = n.BitLength;
|
|
num2 += 7;
|
|
return num2 + num;
|
|
}
|
|
|
|
// Token: 0x06009846 RID: 38982 RVA: 0x001F5F18 File Offset: 0x001F4118
|
|
[Token(Token = "0x6009846")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
protected BigIntegers()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040066E6 RID: 26342
|
|
[Token(Token = "0x40066E6")]
|
|
private const int MaxIterations = 1000;
|
|
}
|
|
}
|