using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x020016A7 RID: 5799 [Token(Token = "0x20016A7")] [StructLayout(3)] public sealed class BlowfishEngine : IBlockCipher { // Token: 0x06009B18 RID: 39704 RVA: 0x0022C634 File Offset: 0x0022A834 [Token(Token = "0x6009B18")] [Address(RVA = "0x22DDBE0", Offset = "0x22DC5E0", VA = "0x1822DDBE0")] public BlowfishEngine() { this.Reset(); uint[] array = new uint[BlowfishEngine.SBOX_SK]; this.S0 = array; uint[] array2 = new uint[BlowfishEngine.SBOX_SK]; this.S1 = array2; uint[] array3 = new uint[BlowfishEngine.SBOX_SK]; this.S2 = array3; uint[] array4 = new uint[BlowfishEngine.SBOX_SK]; this.S3 = array4; uint[] array5 = new uint[BlowfishEngine.P_SZ]; this.P = array5; } // Token: 0x06009B19 RID: 39705 RVA: 0x0022C6A4 File Offset: 0x0022A8A4 [Token(Token = "0x6009B19")] [Address(RVA = "0x22DD130", Offset = "0x22DBB30", VA = "0x1822DD130", Slot = "5")] public void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (06009B19) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.BlowfishEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_2C: stloc:ArgumentException(var_5_3D, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to Blowfish init - "), ldloc:string(var_4)))) } at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88 --- End of inner exception stack trace --- at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663 */; } // Token: 0x170018B9 RID: 6329 // (get) Token: 0x06009B1A RID: 39706 RVA: 0x0022C6F0 File Offset: 0x0022A8F0 [Token(Token = "0x170018B9")] public string AlgorithmName { [Token(Token = "0x6009B1A")] [Address(RVA = "0x22DDCE0", Offset = "0x22DC6E0", VA = "0x1822DDCE0", Slot = "4")] get { return "Blowfish"; } } // Token: 0x170018BA RID: 6330 // (get) Token: 0x06009B1B RID: 39707 RVA: 0x0022C704 File Offset: 0x0022A904 [Token(Token = "0x170018BA")] public bool IsPartialBlockOkay { [Token(Token = "0x6009B1B")] [Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "7")] get { } } // Token: 0x06009B1C RID: 39708 RVA: 0x0022C714 File Offset: 0x0022A914 [Token(Token = "0x6009B1C")] [Address(RVA = "0x22DD2D0", Offset = "0x22DBCD0", VA = "0x1822DD2D0", Slot = "8")] public int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff) { /* An exception occurred when decompiling this method (06009B1C) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.BlowfishEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_25: stloc:InvalidOperationException(var_1_2F, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Blowfish not initialised"))) } at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88 --- End of inner exception stack trace --- at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663 */; } // Token: 0x06009B1D RID: 39709 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x6009B1D")] [Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60", Slot = "9")] public void Reset() { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x06009B1E RID: 39710 RVA: 0x0022C750 File Offset: 0x0022A950 [Token(Token = "0x6009B1E")] [Address(RVA = "0x56E570", Offset = "0x56CF70", VA = "0x18056E570", Slot = "6")] public int GetBlockSize() { return 8; } // Token: 0x06009B1F RID: 39711 RVA: 0x0022C760 File Offset: 0x0022A960 [Token(Token = "0x6009B1F")] [Address(RVA = "0x22DD070", Offset = "0x22DBA70", VA = "0x1822DD070")] private uint F(uint x) { uint[] s = this.S0; uint[] s2 = this.S1; uint[] s3 = this.S2; uint[] s4 = this.S3; return x; } // Token: 0x06009B20 RID: 39712 RVA: 0x0022C790 File Offset: 0x0022A990 [Token(Token = "0x6009B20")] [Address(RVA = "0x22DD3D0", Offset = "0x22DBDD0", VA = "0x1822DD3D0")] private void ProcessTable(uint xl, uint xr, uint[] table) { int length = table.Length; int num = 0; if (length > 0) { uint[] p = this.P; uint num2 = this.F(xl); uint[] p2 = this.P; uint num3 = this.F(xl); uint[] p3 = this.P; uint num5; uint num4 = num5 + 1U; uint num6 = p3[(int)num4]; num5 += (uint)2; uint[] p4 = this.P; num3 += (uint)1; uint num7 = p4[(int)num3]; table[0] = num7; table[0] = xl; num += 2; } } // Token: 0x06009B21 RID: 39713 RVA: 0x0022C824 File Offset: 0x0022AA24 [Token(Token = "0x6009B21")] [Address(RVA = "0x22DD610", Offset = "0x22DC010", VA = "0x1822DD610")] private void SetKey(byte[] key) { int num = 0; uint[] s = this.S0; int num2 = 0; int num3 = 0; int sbox_SK = BlowfishEngine.SBOX_SK; Array.Copy(BlowfishEngine.KS0, num3, s, num2, sbox_SK); int num4 = 0; uint[] s2 = this.S1; int num5 = 0; int sbox_SK2 = BlowfishEngine.SBOX_SK; Array.Copy(BlowfishEngine.KS1, num5, s2, num4, sbox_SK2); int num6 = 0; uint[] s3 = this.S2; int num7 = 0; int sbox_SK3 = BlowfishEngine.SBOX_SK; Array.Copy(BlowfishEngine.KS2, num7, s3, num6, sbox_SK3); int num8 = 0; uint[] s4 = this.S3; int num9 = 0; int sbox_SK4 = BlowfishEngine.SBOX_SK; Array.Copy(BlowfishEngine.KS3, num9, s4, num8, sbox_SK4); int num10 = 0; uint[] p = this.P; int num11 = 0; int p_SZ = BlowfishEngine.P_SZ; Array.Copy(BlowfishEngine.KP, num11, p, num10, p_SZ); int length = key.Length; int length2 = key.Length; num++; uint[] p2 = this.P; num++; uint[] p3 = this.P; int num12 = 0; int num13 = 0; this.ProcessTable((uint)num13, (uint)num12, p3); uint[] p4 = this.P; int p_SZ2 = BlowfishEngine.P_SZ; uint num14 = this.P[p_SZ2]; uint[] s5 = this.S0; uint num15; this.ProcessTable(num15, num14, s5); uint[] s6 = this.S0; int sbox_SK5 = BlowfishEngine.SBOX_SK; int length3 = s6.Length; uint num16 = s6[(int)num14]; uint num17 = s6[sbox_SK5]; uint[] s7 = this.S1; this.ProcessTable(num16, num17, s7); uint[] s8 = this.S1; int sbox_SK6 = BlowfishEngine.SBOX_SK; int length4 = s8.Length; uint num18 = s8[(int)num17]; uint num19 = s8[sbox_SK6]; uint[] s9 = this.S2; this.ProcessTable(num18, num19, s9); uint[] s10 = this.S2; int sbox_SK7 = BlowfishEngine.SBOX_SK; int length5 = s10.Length; uint num20 = s10[(int)num19]; uint num21 = s10[sbox_SK7]; uint[] s11 = this.S3; this.ProcessTable(num20, num21, s11); } // Token: 0x06009B22 RID: 39714 RVA: 0x0022CA28 File Offset: 0x0022AC28 [Token(Token = "0x6009B22")] [Address(RVA = "0x22DCE90", Offset = "0x22DB890", VA = "0x1822DCE90")] private void EncryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) { uint[] p = this.P; uint num = this.F((uint)srcIndex); uint[] p2 = this.P; uint num2 = this.F((uint)srcIndex); uint[] p3 = this.P; uint num4; uint num3 = num4 + 1U; uint num5 = p3[(int)num3]; num4 += (uint)2; uint[] p4 = this.P; num2 += (uint)1; uint num6 = p4[(int)num2]; } // Token: 0x06009B23 RID: 39715 RVA: 0x0022CA98 File Offset: 0x0022AC98 [Token(Token = "0x6009B23")] [Address(RVA = "0x22DCCD0", Offset = "0x22DB6D0", VA = "0x1822DCCD0")] private void DecryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) { uint[] p = this.P; int rounds = BlowfishEngine.ROUNDS; int num = rounds + 1; if (rounds > 0) { uint num2 = this.F((uint)srcIndex); uint[] p2 = this.P; uint num3 = this.F((uint)srcIndex); uint[] p3 = this.P; int num4 = rounds - 1; } uint num5 = this.P[0]; } // Token: 0x06009B24 RID: 39716 RVA: 0x0022CAF4 File Offset: 0x0022ACF4 // Note: this type is marked as 'beforefieldinit'. [Token(Token = "0x6009B24")] [Address(RVA = "0x22DDA60", Offset = "0x22DC460", VA = "0x1822DDA60")] static BlowfishEngine() { uint[] array = new uint[18]; RuntimeHelpers.InitializeArray(array, fieldof(.643A9D76937E94519B73BE072D65E79BAFF3C213).FieldHandle); BlowfishEngine.KP = array; uint[] array2 = new uint[256]; RuntimeHelpers.InitializeArray(array2, fieldof(.E117A40BF9A3AE32474AD7B22EB4C60E95D3BE2A).FieldHandle); BlowfishEngine.KS0 = array2; uint[] array3 = new uint[256]; RuntimeHelpers.InitializeArray(array3, fieldof(.6F576E8737EAAC9B6B12BDFC370048CD205E2CDD).FieldHandle); BlowfishEngine.KS1 = array3; uint[] array4 = new uint[256]; RuntimeHelpers.InitializeArray(array4, fieldof(.E2F8F75B7ABE5A6E4ECF5E32B935909BE2CC9F4B).FieldHandle); BlowfishEngine.KS2 = array4; uint[] array5 = new uint[256]; RuntimeHelpers.InitializeArray(array5, fieldof(.1C1237F52E2ED7B4D229AE3978DA144B9E653F5E).FieldHandle); BlowfishEngine.KS3 = array5; int num = BlowfishEngine.ROUNDS; num += 2; BlowfishEngine.P_SZ = num; } // Token: 0x040065C0 RID: 26048 [Token(Token = "0x40065C0")] private static readonly uint[] KP; // Token: 0x040065C1 RID: 26049 [Token(Token = "0x40065C1")] private static readonly uint[] KS0; // Token: 0x040065C2 RID: 26050 [Token(Token = "0x40065C2")] private static readonly uint[] KS1; // Token: 0x040065C3 RID: 26051 [Token(Token = "0x40065C3")] private static readonly uint[] KS2; // Token: 0x040065C4 RID: 26052 [Token(Token = "0x40065C4")] private static readonly uint[] KS3; // Token: 0x040065C5 RID: 26053 [Token(Token = "0x40065C5")] private static readonly int ROUNDS; // Token: 0x040065C6 RID: 26054 [Token(Token = "0x40065C6")] private const int BLOCK_SIZE = 8; // Token: 0x040065C7 RID: 26055 [Token(Token = "0x40065C7")] private static readonly int SBOX_SK; // Token: 0x040065C8 RID: 26056 [Token(Token = "0x40065C8")] private static readonly int P_SZ; // Token: 0x040065C9 RID: 26057 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x40065C9")] private readonly uint[] S0; // Token: 0x040065CA RID: 26058 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x40065CA")] private readonly uint[] S1; // Token: 0x040065CB RID: 26059 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x40065CB")] private readonly uint[] S2; // Token: 0x040065CC RID: 26060 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x40065CC")] private readonly uint[] S3; // Token: 0x040065CD RID: 26061 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x40065CD")] private readonly uint[] P; // Token: 0x040065CE RID: 26062 [global::Cpp2IlInjected.FieldOffset(Offset = "0x38")] [Token(Token = "0x40065CE")] private bool encrypting; // Token: 0x040065CF RID: 26063 [global::Cpp2IlInjected.FieldOffset(Offset = "0x40")] [Token(Token = "0x40065CF")] private byte[] workingKey; } }