using System; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x02001C96 RID: 7318 [Token(Token = "0x2001C96")] public class IdeaEngine : IBlockCipher { // Token: 0x0600B7D3 RID: 47059 RVA: 0x0028C3F4 File Offset: 0x0028A5F4 [Token(Token = "0x600B7D3")] [Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")] public IdeaEngine() { this.Reset(); } // Token: 0x0600B7D4 RID: 47060 RVA: 0x0028C408 File Offset: 0x0028A608 [Token(Token = "0x600B7D4")] [Address(RVA = "0x1DD0CE0", Offset = "0x1DCFAE0", VA = "0x181DD0CE0", Slot = "10")] public virtual void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (0600B7D4) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.IdeaEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_36: stloc:ArgumentException(var_7_47, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to IDEA init - "), ldloc:string(var_6)))) } 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 1660 */; } // Token: 0x17001CD3 RID: 7379 // (get) Token: 0x0600B7D5 RID: 47061 RVA: 0x0028C460 File Offset: 0x0028A660 [Token(Token = "0x17001CD3")] public virtual string AlgorithmName { [Token(Token = "0x600B7D5")] [Address(RVA = "0x1DD1A50", Offset = "0x1DD0850", VA = "0x181DD1A50", Slot = "11")] get { return "IDEA"; } } // Token: 0x17001CD4 RID: 7380 // (get) Token: 0x0600B7D6 RID: 47062 RVA: 0x0028C474 File Offset: 0x0028A674 [Token(Token = "0x17001CD4")] public virtual bool IsPartialBlockOkay { [Token(Token = "0x600B7D6")] [Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "12")] get { } } // Token: 0x0600B7D7 RID: 47063 RVA: 0x0028C484 File Offset: 0x0028A684 [Token(Token = "0x600B7D7")] [Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "13")] public virtual int GetBlockSize() { return 8; } // Token: 0x0600B7D8 RID: 47064 RVA: 0x0028C494 File Offset: 0x0028A694 [Token(Token = "0x600B7D8")] [Address(RVA = "0x1DD1890", Offset = "0x1DD0690", VA = "0x181DD1890", Slot = "14")] public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff) { /* An exception occurred when decompiling this method (0600B7D8) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.IdeaEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_1A: stloc:InvalidOperationException(var_3_24, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("IDEA engine 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 1660 */; } // Token: 0x0600B7D9 RID: 47065 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600B7D9")] [Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080", Slot = "15")] public virtual void Reset() { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x0600B7DA RID: 47066 RVA: 0x0028C4C8 File Offset: 0x0028A6C8 [Token(Token = "0x600B7DA")] [Address(RVA = "0x1DD03E0", Offset = "0x1DCF1E0", VA = "0x181DD03E0")] private int BytesToWord(byte[] input, int inOff) { int length = input.Length; byte b; byte b2; b += b2; throw new NullReferenceException(); } // Token: 0x0600B7DB RID: 47067 RVA: 0x0028C4E8 File Offset: 0x0028A6E8 [Token(Token = "0x600B7DB")] [Address(RVA = "0x1DD19A0", Offset = "0x1DD07A0", VA = "0x181DD19A0")] private void WordToBytes(int word, byte[] outBytes, int outOff) { } // Token: 0x0600B7DC RID: 47068 RVA: 0x0028C4FC File Offset: 0x0028A6FC [Token(Token = "0x600B7DC")] [Address(RVA = "0x1DD1770", Offset = "0x1DD0570", VA = "0x181DD1770")] private int Mul(int x, int y) { if (x != 0) { if (y != 0) { int num = x * y; int mask = IdeaEngine.MASK; bool flag = mask < num; flag = (flag ? 1 : 0) - num != 0; flag = (flag ? 1 : 0) + mask != 0; } int num2 = IdeaEngine.BASE; num2 -= x; } int num3 = IdeaEngine.BASE; num3 -= y; return IdeaEngine.MASK; } // Token: 0x0600B7DD RID: 47069 RVA: 0x0028C544 File Offset: 0x0028A744 [Token(Token = "0x600B7DD")] [Address(RVA = "0x1DD07A0", Offset = "0x1DCF5A0", VA = "0x181DD07A0")] private void IdeaFunc(int[] workingKey, byte[] input, int inOff, byte[] outBytes, int outOff) { int num = 0; int length = input.Length; int num2 = inOff + 1; byte b; byte b2; b += b2; byte b3; b3 += b2; byte b4; b4 += b2; byte b5; b5 += b2; int num3 = workingKey[num]; int num4 = this.Mul((int)b, num3); int length2 = workingKey.Length; int num5; num5 += (int)b3; int length3 = workingKey.Length; int num6; num6 += (int)b4; num += 3; int num7 = workingKey[num]; num += 4; int num8 = workingKey[num]; int num9; num6 = num9; int num10; num6 += num10; num++; int mask = IdeaEngine.MASK; int num11 = workingKey[num]; int num12; num12 += mask; int num13; int num14; num13 += num14; num += 3; int num15 = workingKey[num]; } // Token: 0x0600B7DE RID: 47070 RVA: 0x0028C60C File Offset: 0x0028A80C [Token(Token = "0x600B7DE")] [Address(RVA = "0x1DD0440", Offset = "0x1DCF240", VA = "0x181DD0440")] private int[] ExpandKey(byte[] uKey) { int[] array = new int[52]; int num = 0; if (uKey.Length < 16) { byte[] array2 = new byte[0]; int length = uKey.Length; int num2 = array2.Length; int num3 = 0; num2 -= length; Array.Copy(uKey, num3, array2, num2, length); } int length2 = uKey.Length; num += 2; byte b; byte b2; b += b2; num++; array[0] = (int)b; int length3 = array.Length; uint num4; if (num4 != (uint)6) { int length4 = array.Length; } int length5 = array.Length; int length6 = array.Length; num4 += (uint)1; int num5; array[0] = num5; return array; } // Token: 0x0600B7DF RID: 47071 RVA: 0x0028C6B8 File Offset: 0x0028A8B8 [Token(Token = "0x600B7DF")] [Address(RVA = "0x1DD15F0", Offset = "0x1DD03F0", VA = "0x181DD15F0")] private int MulInv(int x) { int num = IdeaEngine.BASE; uint num2; if (x != (int)num2) { int num3 = x * x; num2 += (uint)num3; if (x == (int)num2) { return x; } int num4 = x * (int)num2; num = x + num4; } num2 -= (uint)num; return IdeaEngine.MASK; } // Token: 0x0600B7E0 RID: 47072 RVA: 0x0028C6F8 File Offset: 0x0028A8F8 [Token(Token = "0x600B7E0")] [Address(RVA = "0x1DD0380", Offset = "0x1DCF180", VA = "0x181DD0380")] private int AddInv(int x) { return IdeaEngine.MASK; } // Token: 0x0600B7E1 RID: 47073 RVA: 0x0028C70C File Offset: 0x0028A90C [Token(Token = "0x600B7E1")] [Address(RVA = "0x1DD0E90", Offset = "0x1DCFC90", VA = "0x181DD0E90")] private int[] InvertKey(int[] inKey) { int[] array = new int[52]; int num = inKey[0]; int num2 = this.MulInv(num); int mask = IdeaEngine.MASK; int num3 = inKey[1]; int num4 = inKey[1]; int num5 = this.MulInv(num4); array[25] = num5; array[25] = num3; array[24] = mask; array[24] = num2; int length = inKey.Length; uint num7; int num6 = inKey[(int)num7]; uint num8 = num7 + 1U; uint num10; uint num9 = num10 - 1U; int num11 = inKey[(int)num8]; array[0] = num11; num7 += (uint)2; array[0] = num6; int num12 = inKey[(int)num7]; int num13 = this.MulInv(num12); num7 += (uint)3; uint num14 = num7 + 1U; int mask2 = IdeaEngine.MASK; uint num15 = num14 + 1U; int num16 = inKey[(int)num14]; num15 += (uint)1; int num17 = inKey[(int)num15]; int num18; array[0] = num18; array[0] = mask2; array[0] = num16; ulong num19; num19 += (ulong)1L; array[0] = num13; int length2 = inKey.Length; int num20 = inKey[(int)num15]; uint num21 = num15 + 1U; int num22 = inKey[(int)num21]; int num23 = num16 - 1; array[0] = num22; array[0] = num20; int num24 = inKey[num23]; num15 += (uint)4; int mask3 = IdeaEngine.MASK; int num25 = inKey[(int)num15]; num16 += -4; int num26; array[0] = num26; array[0] = num25; array[0] = mask3; int num27; array[0] = num27; return array; } // Token: 0x0600B7E2 RID: 47074 RVA: 0x0028C8C0 File Offset: 0x0028AAC0 [Token(Token = "0x600B7E2")] [Address(RVA = "0x1DD0760", Offset = "0x1DCF560", VA = "0x181DD0760")] private int[] GenerateWorkingKey(bool forEncryption, byte[] userKey) { int[] array = this.ExpandKey(userKey); if (!forEncryption) { int[] array2 = this.InvertKey(array); } return array; } // Token: 0x0400749E RID: 29854 [Token(Token = "0x400749E")] private const int BLOCK_SIZE = 8; // Token: 0x0400749F RID: 29855 [FieldOffset(Offset = "0x10")] [Token(Token = "0x400749F")] private int[] workingKey; // Token: 0x040074A0 RID: 29856 [Token(Token = "0x40074A0")] private static readonly int MASK; // Token: 0x040074A1 RID: 29857 [Token(Token = "0x40074A1")] private static readonly int BASE; } }