Files
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

223 lines
5.9 KiB
C#

using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CB0 RID: 7344
[Token(Token = "0x2001CB0")]
internal class X931Rng
{
// Token: 0x0600B5CC RID: 46540 RVA: 0x0027528C File Offset: 0x0027348C
[Token(Token = "0x600B5CC")]
[Address(RVA = "0x2369E70", Offset = "0x2368E70", VA = "0x182369E70")]
internal X931Rng(IBlockCipher engine, byte[] dateTimeVector, IEntropySource entropySource)
{
this.mEngine = engine;
this.mEntropySource = entropySource;
byte[] array = new byte[0];
this.mDT = array;
int length = array.Length;
int num = 0;
int num2 = 0;
Array.Copy(dateTimeVector, num2, array, num, length);
byte[] array2 = new byte[array];
this.mI = array2;
byte[] array3 = new byte[array2];
this.mR = array3;
}
// Token: 0x0600B5CD RID: 46541 RVA: 0x00275304 File Offset: 0x00273504
[Token(Token = "0x600B5CD")]
[Address(RVA = "0x23697A0", Offset = "0x23687A0", VA = "0x1823697A0")]
internal int Generate(byte[] output, bool predictionResistant)
{
IBlockCipher blockCipher;
int length;
int num2;
do
{
byte[] array = this.mR;
long num = this.mReseedCounter;
if ((array.Length != 8 && output == 0) || output != 0)
{
}
if (predictionResistant || this.mV == (ulong)0L)
{
IEntropySource entropySource = this.mEntropySource;
this.mV = array;
blockCipher = this.mEngine;
if (array.Length != array)
{
continue;
}
}
byte[] array2 = this.mR;
length = output.Length;
num2 = 0;
}
while (length <= 0);
IBlockCipher blockCipher2 = this.mEngine;
int num3 = 0;
if (num3 < blockCipher)
{
num3 += num3;
num3++;
}
byte[] array3 = this.mV;
byte[] array4 = this.mI;
byte[] array5 = this.mR;
this.Process(array5, array4, array3);
byte[] array6 = this.mI;
byte[] array7 = this.mR;
byte[] array8 = this.mV;
this.Process(array8, array7, array6);
byte[] array9 = this.mR;
int length2 = array9.Length;
int num4 = length2 * num2;
int num5 = 0;
Array.Copy(array9, num5, output, num4, length2);
byte[] array10 = this.mDT;
if (array10.Length == array10.Length)
{
}
num2++;
int length3 = this.mR.Length;
int num6 = output.Length;
int num7 = length3 * length;
num6 -= num7;
if (num6 > 0)
{
IBlockCipher blockCipher3 = this.mEngine;
byte[] array11 = this.mI;
byte[] array12 = this.mV;
byte[] array13 = this.mI;
byte[] array14 = this.mR;
this.Process(array14, array13, array12);
byte[] array15 = this.mI;
byte[] array16 = this.mR;
byte[] array17 = this.mV;
this.Process(array17, array16, array15);
byte[] array18 = this.mR;
int num8 = array18.Length * length;
int num9 = 0;
Array.Copy(array18, num9, output, num8, num6);
byte[] array19 = this.mDT;
int length4 = array19.Length;
if (length4 == array19.Length)
{
}
}
return output.Length;
}
// Token: 0x0600B5CE RID: 46542 RVA: 0x0027550C File Offset: 0x0027370C
[Token(Token = "0x600B5CE")]
[Address(RVA = "0x2369DB0", Offset = "0x2368DB0", VA = "0x182369DB0")]
internal void Reseed()
{
IEntropySource entropySource = this.mEntropySource;
IBlockCipher blockCipher = this.mEngine;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x17001C91 RID: 7313
// (get) Token: 0x0600B5CF RID: 46543 RVA: 0x00275544 File Offset: 0x00273744
[Token(Token = "0x17001C91")]
internal IEntropySource EntropySource
{
[Token(Token = "0x600B5CF")]
[Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0")]
get
{
return this.mEntropySource;
}
}
// Token: 0x0600B5D0 RID: 46544 RVA: 0x00275558 File Offset: 0x00273758
[Token(Token = "0x600B5D0")]
[Address(RVA = "0x2369CB0", Offset = "0x2368CB0", VA = "0x182369CB0")]
private void Process(byte[] res, byte[] a, byte[] b)
{
int num = 0;
int length = res.Length;
if (num != length)
{
num++;
}
IBlockCipher blockCipher = this.mEngine;
}
// Token: 0x0600B5D1 RID: 46545 RVA: 0x00275584 File Offset: 0x00273784
[Token(Token = "0x600B5D1")]
[Address(RVA = "0x2369C60", Offset = "0x2368C60", VA = "0x182369C60")]
private void Increment(byte[] val)
{
if (val.Length == val.Length)
{
}
}
// Token: 0x0600B5D2 RID: 46546 RVA: 0x002755A8 File Offset: 0x002737A8
[Token(Token = "0x600B5D2")]
[Address(RVA = "0x2355420", Offset = "0x2354420", VA = "0x182355420")]
private static bool IsTooLarge(byte[] bytes, int maxBytes)
{
if (bytes == 0)
{
}
return bytes.Length > maxBytes;
}
// Token: 0x0400731B RID: 29467
[Token(Token = "0x400731B")]
private const long BLOCK64_RESEED_MAX = 32768L;
// Token: 0x0400731C RID: 29468
[Token(Token = "0x400731C")]
private const long BLOCK128_RESEED_MAX = 8388608L;
// Token: 0x0400731D RID: 29469
[Token(Token = "0x400731D")]
private const int BLOCK64_MAX_BITS_REQUEST = 4096;
// Token: 0x0400731E RID: 29470
[Token(Token = "0x400731E")]
private const int BLOCK128_MAX_BITS_REQUEST = 262144;
// Token: 0x0400731F RID: 29471
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400731F")]
private readonly IBlockCipher mEngine;
// Token: 0x04007320 RID: 29472
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007320")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007321 RID: 29473
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007321")]
private readonly byte[] mDT;
// Token: 0x04007322 RID: 29474
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007322")]
private readonly byte[] mI;
// Token: 0x04007323 RID: 29475
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007323")]
private readonly byte[] mR;
// Token: 0x04007324 RID: 29476
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007324")]
private byte[] mV;
// Token: 0x04007325 RID: 29477
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007325")]
private long mReseedCounter = (long)((ulong)1L);
}
}