92 lines
2.8 KiB
C#
92 lines
2.8 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities
|
|
{
|
|
// Token: 0x02001344 RID: 4932
|
|
[Token(Token = "0x2001344")]
|
|
[StructLayout(3)]
|
|
public abstract class BigIntegers
|
|
{
|
|
// Token: 0x06007C68 RID: 31848 RVA: 0x0019E424 File Offset: 0x0019C624
|
|
[Token(Token = "0x6007C68")]
|
|
[Address(RVA = "0x1C5D8B0", Offset = "0x1C5C2B0", VA = "0x181C5D8B0")]
|
|
public static byte[] AsUnsignedByteArray(BigInteger n)
|
|
{
|
|
return n.ToByteArrayUnsigned();
|
|
}
|
|
|
|
// Token: 0x06007C69 RID: 31849 RVA: 0x0019E440 File Offset: 0x0019C640
|
|
[Token(Token = "0x6007C69")]
|
|
[Address(RVA = "0x1C5D8D0", Offset = "0x1C5C2D0", VA = "0x181C5D8D0")]
|
|
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: 0x06007C6A RID: 31850 RVA: 0x0019E48C File Offset: 0x0019C68C
|
|
[Token(Token = "0x6007C6A")]
|
|
[Address(RVA = "0x1C5D9A0", Offset = "0x1C5C3A0", VA = "0x181C5D9A0")]
|
|
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: 0x06007C6B RID: 31851 RVA: 0x0019E52C File Offset: 0x0019C72C
|
|
[Token(Token = "0x6007C6B")]
|
|
[Address(RVA = "0x1C5DBB0", Offset = "0x1C5C5B0", VA = "0x181C5DBB0")]
|
|
public static int GetUnsignedByteLength(BigInteger n)
|
|
{
|
|
int num = 0;
|
|
int num2 = n.BitLength;
|
|
num2 += 7;
|
|
return num2 + num;
|
|
}
|
|
|
|
// Token: 0x06007C6C RID: 31852 RVA: 0x0019E554 File Offset: 0x0019C754
|
|
[Token(Token = "0x6007C6C")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
protected BigIntegers()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040058A3 RID: 22691
|
|
[Token(Token = "0x40058A3")]
|
|
private const int MaxIterations = 1000;
|
|
}
|
|
}
|