using System; using System.Runtime.InteropServices; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng { // Token: 0x020015F3 RID: 5619 [Token(Token = "0x20015F3")] [StructLayout(3)] internal class X931Rng { // Token: 0x06009624 RID: 38436 RVA: 0x00214A84 File Offset: 0x00212C84 [Token(Token = "0x6009624")] [Address(RVA = "0x1E4E0F0", Offset = "0x1E4CAF0", VA = "0x181E4E0F0")] 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: 0x06009625 RID: 38437 RVA: 0x00214AFC File Offset: 0x00212CFC [Token(Token = "0x6009625")] [Address(RVA = "0x1E4DA20", Offset = "0x1E4C420", VA = "0x181E4DA20")] 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: 0x06009626 RID: 38438 RVA: 0x00214D04 File Offset: 0x00212F04 [Token(Token = "0x6009626")] [Address(RVA = "0x1E4E030", Offset = "0x1E4CA30", VA = "0x181E4E030")] internal void Reseed() { IEntropySource entropySource = this.mEntropySource; IBlockCipher blockCipher = this.mEngine; this.mReseedCounter = (long)((ulong)1L); } // Token: 0x170017F3 RID: 6131 // (get) Token: 0x06009627 RID: 38439 RVA: 0x00214D3C File Offset: 0x00212F3C [Token(Token = "0x170017F3")] internal IEntropySource EntropySource { [Token(Token = "0x6009627")] [Address(RVA = "0x3C1240", Offset = "0x3BFC40", VA = "0x1803C1240")] get { return this.mEntropySource; } } // Token: 0x06009628 RID: 38440 RVA: 0x00214D50 File Offset: 0x00212F50 [Token(Token = "0x6009628")] [Address(RVA = "0x1E4DF30", Offset = "0x1E4C930", VA = "0x181E4DF30")] 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: 0x06009629 RID: 38441 RVA: 0x00214D7C File Offset: 0x00212F7C [Token(Token = "0x6009629")] [Address(RVA = "0x1E4DEE0", Offset = "0x1E4C8E0", VA = "0x181E4DEE0")] private void Increment(byte[] val) { if (val.Length == val.Length) { } } // Token: 0x0600962A RID: 38442 RVA: 0x00214DA0 File Offset: 0x00212FA0 [Token(Token = "0x600962A")] [Address(RVA = "0x1E3A1E0", Offset = "0x1E38BE0", VA = "0x181E3A1E0")] private static bool IsTooLarge(byte[] bytes, int maxBytes) { if (bytes == 0) { } return bytes.Length > maxBytes; } // Token: 0x0400631F RID: 25375 [Token(Token = "0x400631F")] private const long BLOCK64_RESEED_MAX = 32768L; // Token: 0x04006320 RID: 25376 [Token(Token = "0x4006320")] private const long BLOCK128_RESEED_MAX = 8388608L; // Token: 0x04006321 RID: 25377 [Token(Token = "0x4006321")] private const int BLOCK64_MAX_BITS_REQUEST = 4096; // Token: 0x04006322 RID: 25378 [Token(Token = "0x4006322")] private const int BLOCK128_MAX_BITS_REQUEST = 262144; // Token: 0x04006323 RID: 25379 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x4006323")] private readonly IBlockCipher mEngine; // Token: 0x04006324 RID: 25380 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x4006324")] private readonly IEntropySource mEntropySource; // Token: 0x04006325 RID: 25381 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x4006325")] private readonly byte[] mDT; // Token: 0x04006326 RID: 25382 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x4006326")] private readonly byte[] mI; // Token: 0x04006327 RID: 25383 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x4006327")] private readonly byte[] mR; // Token: 0x04006328 RID: 25384 [global::Cpp2IlInjected.FieldOffset(Offset = "0x38")] [Token(Token = "0x4006328")] private byte[] mV; // Token: 0x04006329 RID: 25385 [global::Cpp2IlInjected.FieldOffset(Offset = "0x40")] [Token(Token = "0x4006329")] private long mReseedCounter = (long)((ulong)1L); } }