m
This commit is contained in:
+361
@@ -0,0 +1,361 @@
|
||||
using System;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
||||
{
|
||||
// Token: 0x02001D76 RID: 7542
|
||||
[Token(Token = "0x2001D76")]
|
||||
public class IdeaEngine : IBlockCipher
|
||||
{
|
||||
// Token: 0x0600BBA1 RID: 48033 RVA: 0x00295500 File Offset: 0x00293700
|
||||
[Token(Token = "0x600BBA1")]
|
||||
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
||||
public IdeaEngine()
|
||||
{
|
||||
this.Reset();
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA2 RID: 48034 RVA: 0x00295514 File Offset: 0x00293714
|
||||
[Token(Token = "0x600BBA2")]
|
||||
[Address(RVA = "0x27F31A0", Offset = "0x27F21A0", VA = "0x1827F31A0", Slot = "10")]
|
||||
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600BBA2)
|
||||
|
||||
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 1663
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x17001D70 RID: 7536
|
||||
// (get) Token: 0x0600BBA3 RID: 48035 RVA: 0x0029556C File Offset: 0x0029376C
|
||||
[Token(Token = "0x17001D70")]
|
||||
public virtual string AlgorithmName
|
||||
{
|
||||
[Token(Token = "0x600BBA3")]
|
||||
[Address(RVA = "0x27F3F10", Offset = "0x27F2F10", VA = "0x1827F3F10", Slot = "11")]
|
||||
get
|
||||
{
|
||||
return "IDEA";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001D71 RID: 7537
|
||||
// (get) Token: 0x0600BBA4 RID: 48036 RVA: 0x00295580 File Offset: 0x00293780
|
||||
[Token(Token = "0x17001D71")]
|
||||
public virtual bool IsPartialBlockOkay
|
||||
{
|
||||
[Token(Token = "0x600BBA4")]
|
||||
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "12")]
|
||||
get
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA5 RID: 48037 RVA: 0x00295590 File Offset: 0x00293790
|
||||
[Token(Token = "0x600BBA5")]
|
||||
[Address(RVA = "0x681E00", Offset = "0x680E00", VA = "0x180681E00", Slot = "13")]
|
||||
public virtual int GetBlockSize()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA6 RID: 48038 RVA: 0x002955A0 File Offset: 0x002937A0
|
||||
[Token(Token = "0x600BBA6")]
|
||||
[Address(RVA = "0x27F3D50", Offset = "0x27F2D50", VA = "0x1827F3D50", Slot = "14")]
|
||||
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600BBA6)
|
||||
|
||||
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 1663
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA7 RID: 48039 RVA: 0x0000220F File Offset: 0x0000040F
|
||||
[Token(Token = "0x600BBA7")]
|
||||
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "15")]
|
||||
public virtual void Reset()
|
||||
{
|
||||
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA8 RID: 48040 RVA: 0x002955D4 File Offset: 0x002937D4
|
||||
[Token(Token = "0x600BBA8")]
|
||||
[Address(RVA = "0x27F28A0", Offset = "0x27F18A0", VA = "0x1827F28A0")]
|
||||
private int BytesToWord(byte[] input, int inOff)
|
||||
{
|
||||
int length = input.Length;
|
||||
byte b;
|
||||
byte b2;
|
||||
b += b2;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600BBA9 RID: 48041 RVA: 0x002955F4 File Offset: 0x002937F4
|
||||
[Token(Token = "0x600BBA9")]
|
||||
[Address(RVA = "0x27F3E60", Offset = "0x27F2E60", VA = "0x1827F3E60")]
|
||||
private void WordToBytes(int word, byte[] outBytes, int outOff)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600BBAA RID: 48042 RVA: 0x00295608 File Offset: 0x00293808
|
||||
[Token(Token = "0x600BBAA")]
|
||||
[Address(RVA = "0x27F3C30", Offset = "0x27F2C30", VA = "0x1827F3C30")]
|
||||
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: 0x0600BBAB RID: 48043 RVA: 0x00295650 File Offset: 0x00293850
|
||||
[Token(Token = "0x600BBAB")]
|
||||
[Address(RVA = "0x27F2C60", Offset = "0x27F1C60", VA = "0x1827F2C60")]
|
||||
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: 0x0600BBAC RID: 48044 RVA: 0x00295718 File Offset: 0x00293918
|
||||
[Token(Token = "0x600BBAC")]
|
||||
[Address(RVA = "0x27F2900", Offset = "0x27F1900", VA = "0x1827F2900")]
|
||||
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: 0x0600BBAD RID: 48045 RVA: 0x002957C4 File Offset: 0x002939C4
|
||||
[Token(Token = "0x600BBAD")]
|
||||
[Address(RVA = "0x27F3AB0", Offset = "0x27F2AB0", VA = "0x1827F3AB0")]
|
||||
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: 0x0600BBAE RID: 48046 RVA: 0x00295804 File Offset: 0x00293A04
|
||||
[Token(Token = "0x600BBAE")]
|
||||
[Address(RVA = "0x27F2840", Offset = "0x27F1840", VA = "0x1827F2840")]
|
||||
private int AddInv(int x)
|
||||
{
|
||||
return IdeaEngine.MASK;
|
||||
}
|
||||
|
||||
// Token: 0x0600BBAF RID: 48047 RVA: 0x00295818 File Offset: 0x00293A18
|
||||
[Token(Token = "0x600BBAF")]
|
||||
[Address(RVA = "0x27F3350", Offset = "0x27F2350", VA = "0x1827F3350")]
|
||||
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: 0x0600BBB0 RID: 48048 RVA: 0x002959CC File Offset: 0x00293BCC
|
||||
[Token(Token = "0x600BBB0")]
|
||||
[Address(RVA = "0x27F2C20", Offset = "0x27F1C20", VA = "0x1827F2C20")]
|
||||
private int[] GenerateWorkingKey(bool forEncryption, byte[] userKey)
|
||||
{
|
||||
int[] array = this.ExpandKey(userKey);
|
||||
if (!forEncryption)
|
||||
{
|
||||
int[] array2 = this.InvertKey(array);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x04007657 RID: 30295
|
||||
[Token(Token = "0x4007657")]
|
||||
private const int BLOCK_SIZE = 8;
|
||||
|
||||
// Token: 0x04007658 RID: 30296
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4007658")]
|
||||
private int[] workingKey;
|
||||
|
||||
// Token: 0x04007659 RID: 30297
|
||||
[Token(Token = "0x4007659")]
|
||||
private static readonly int MASK;
|
||||
|
||||
// Token: 0x0400765A RID: 30298
|
||||
[Token(Token = "0x400765A")]
|
||||
private static readonly int BASE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user