Files
27Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Prng/ThreadedSeedGenerator.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

111 lines
2.9 KiB
C#

using System;
using System.Threading;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CAD RID: 7341
[Token(Token = "0x2001CAD")]
public class ThreadedSeedGenerator
{
// Token: 0x0600B5C1 RID: 46529 RVA: 0x00274F54 File Offset: 0x00273154
[Token(Token = "0x600B5C1")]
[Address(RVA = "0x2367FA0", Offset = "0x2366FA0", VA = "0x182367FA0")]
public byte[] GenerateSeed(int numBytes, bool fast)
{
return new ThreadedSeedGenerator.SeedGenerator().GenerateSeed(numBytes, fast);
}
// Token: 0x0600B5C2 RID: 46530 RVA: 0x00274F74 File Offset: 0x00273174
[Token(Token = "0x600B5C2")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public ThreadedSeedGenerator()
{
}
// Token: 0x02001CAE RID: 7342
[Token(Token = "0x2001CAE")]
private class SeedGenerator
{
// Token: 0x0600B5C3 RID: 46531 RVA: 0x00274F88 File Offset: 0x00273188
[Token(Token = "0x600B5C3")]
[Address(RVA = "0x2367F50", Offset = "0x2366F50", VA = "0x182367F50")]
private void Run(object ignored)
{
while (!this.stop)
{
int num = this.counter + 1;
this.counter = num;
if (this.stop)
{
break;
}
}
}
// Token: 0x0600B5C4 RID: 46532 RVA: 0x00274FB8 File Offset: 0x002731B8
[Token(Token = "0x600B5C4")]
[Address(RVA = "0x2367E40", Offset = "0x2366E40", VA = "0x182367E40")]
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);
}
while (num != 0);
return array;
}
// Token: 0x0600B5C5 RID: 46533 RVA: 0x0027500C File Offset: 0x0027320C
[Token(Token = "0x600B5C5")]
[Address(RVA = "0x2367C90", Offset = "0x2366C90", VA = "0x182367C90")]
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: 0x0600B5C6 RID: 46534 RVA: 0x00275088 File Offset: 0x00273288
[Token(Token = "0x600B5C6")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public SeedGenerator()
{
}
// Token: 0x04007316 RID: 29462
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007316")]
private int counter;
// Token: 0x04007317 RID: 29463
[FieldOffset(Offset = "0x14")]
[Token(Token = "0x4007317")]
private bool stop;
}
}
}