Files
Jan2021-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Prng/ThreadedSeedGenerator.cs
T
2026-04-08 23:40:05 +02:00

116 lines
3.1 KiB
C#

using System;
using System.Runtime.InteropServices;
using System.Threading;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x020015F0 RID: 5616
[Token(Token = "0x20015F0")]
[StructLayout(3)]
public class ThreadedSeedGenerator
{
// Token: 0x06009619 RID: 38425 RVA: 0x00214740 File Offset: 0x00212940
[Token(Token = "0x6009619")]
[Address(RVA = "0x1E4D460", Offset = "0x1E4BE60", VA = "0x181E4D460")]
public byte[] GenerateSeed(int numBytes, bool fast)
{
return new ThreadedSeedGenerator.SeedGenerator().GenerateSeed(numBytes, fast);
}
// Token: 0x0600961A RID: 38426 RVA: 0x00214760 File Offset: 0x00212960
[Token(Token = "0x600961A")]
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
public ThreadedSeedGenerator()
{
}
// Token: 0x020015F1 RID: 5617
[Token(Token = "0x20015F1")]
private class SeedGenerator
{
// Token: 0x0600961B RID: 38427 RVA: 0x00214774 File Offset: 0x00212974
[Token(Token = "0x600961B")]
[Address(RVA = "0x1E4C960", Offset = "0x1E4B360", VA = "0x181E4C960")]
private void Run(object ignored)
{
while (!this.stop)
{
int num = this.counter + 1;
this.counter = num;
if (this.stop)
{
break;
}
}
}
// Token: 0x0600961C RID: 38428 RVA: 0x002147A4 File Offset: 0x002129A4
[Token(Token = "0x600961C")]
[Address(RVA = "0x1E4C830", Offset = "0x1E4B230", VA = "0x181E4C830")]
public byte[] GenerateSeed(int numBytes, bool fast)
{
int num;
byte[] array;
do
{
num = 0;
ThreadPriority priority = Thread.CurrentThread.Priority;
Thread.CurrentThread.Priority = ThreadPriority.Normal;
array = this.DoGenerateSeed(numBytes, fast);
Thread.CurrentThread.SetPriorityNative(numBytes);
if (num != -1)
{
}
}
while (num != 0);
return array;
}
// Token: 0x0600961D RID: 38429 RVA: 0x002147FC File Offset: 0x002129FC
[Token(Token = "0x600961D")]
[Address(RVA = "0x1E4C680", Offset = "0x1E4B080", VA = "0x181E4C680")]
private byte[] DoGenerateSeed(int numBytes, bool fast)
{
int num = 0;
this.counter = num;
this.stop = num != 0;
byte[] array = new byte[numBytes];
WaitCallback waitCallback = new WaitCallback(this.Run);
int num2 = 0;
bool flag = ThreadPool.QueueUserWorkItem(waitCallback);
if (this.counter == num)
{
Thread.Sleep(1);
}
int num3 = this.counter;
num += num2;
byte b;
b += b;
num++;
int length = array.Length;
num++;
this.stop = true;
return array;
}
// Token: 0x0600961E RID: 38430 RVA: 0x00214878 File Offset: 0x00212A78
[Token(Token = "0x600961E")]
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
public SeedGenerator()
{
}
// Token: 0x0400631A RID: 25370
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
[Token(Token = "0x400631A")]
private int counter;
// Token: 0x0400631B RID: 25371
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
[Token(Token = "0x400631B")]
private bool stop;
}
}
}