168 lines
6.5 KiB
C#
168 lines
6.5 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x02001C9D RID: 7325
|
|
[Token(Token = "0x2001C9D")]
|
|
public class RC4Engine : IStreamCipher
|
|
{
|
|
// Token: 0x0600B821 RID: 47137 RVA: 0x0028E680 File Offset: 0x0028C880
|
|
[Token(Token = "0x600B821")]
|
|
[Address(RVA = "0x1DF1490", Offset = "0x1DF0290", VA = "0x181DF1490", Slot = "9")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B821)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC4Engine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_25:
|
|
stloc:ArgumentException(var_5_36, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to RC4 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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x17001CDE RID: 7390
|
|
// (get) Token: 0x0600B822 RID: 47138 RVA: 0x0028E6C4 File Offset: 0x0028C8C4
|
|
[Token(Token = "0x17001CDE")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B822")]
|
|
[Address(RVA = "0x1DF1C70", Offset = "0x1DF0A70", VA = "0x181DF1C70", Slot = "10")]
|
|
get
|
|
{
|
|
return "RC4";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B823 RID: 47139 RVA: 0x0028E6D8 File Offset: 0x0028C8D8
|
|
[Token(Token = "0x600B823")]
|
|
[Address(RVA = "0x1DF18A0", Offset = "0x1DF06A0", VA = "0x181DF18A0", Slot = "11")]
|
|
public virtual byte ReturnByte(byte input)
|
|
{
|
|
int num = this.x;
|
|
byte[] array = this.engineState;
|
|
num++;
|
|
this.x = num;
|
|
byte b;
|
|
this.y = (int)b;
|
|
int length = array.Length;
|
|
byte[] array2 = this.engineState;
|
|
int num2 = this.y;
|
|
byte[] array3 = this.engineState;
|
|
int num3 = this.x;
|
|
int length2 = array3.Length;
|
|
int num4 = this.y;
|
|
byte b2;
|
|
byte b3;
|
|
b2 += b3;
|
|
b3 = b2;
|
|
byte b4;
|
|
return b4;
|
|
}
|
|
|
|
// Token: 0x0600B824 RID: 47140 RVA: 0x0028E750 File Offset: 0x0028C950
|
|
[Token(Token = "0x600B824")]
|
|
[Address(RVA = "0x1DF1620", Offset = "0x1DF0420", VA = "0x181DF1620", Slot = "12")]
|
|
public virtual void ProcessBytes(byte[] input, int inOff, int length, byte[] output, int outOff)
|
|
{
|
|
Check.DataLength(input, inOff, inOff, "input buffer too short");
|
|
if (length > 0)
|
|
{
|
|
int num = this.x;
|
|
byte[] array = this.engineState;
|
|
num++;
|
|
this.x = num;
|
|
byte b;
|
|
this.y = (int)b;
|
|
int length2 = array.Length;
|
|
byte[] array2 = this.engineState;
|
|
int num2 = this.y;
|
|
byte[] array3 = this.engineState;
|
|
int num3 = this.x;
|
|
int length3 = array3.Length;
|
|
int num4 = this.y;
|
|
byte b2;
|
|
byte b3;
|
|
b2 += b3;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B825 RID: 47141 RVA: 0x0028E7D8 File Offset: 0x0028C9D8
|
|
[Token(Token = "0x600B825")]
|
|
[Address(RVA = "0x1DF1890", Offset = "0x1DF0690", VA = "0x181DF1890", Slot = "13")]
|
|
public virtual void Reset()
|
|
{
|
|
byte[] array = this.workingKey;
|
|
this.SetKey(array);
|
|
}
|
|
|
|
// Token: 0x0600B826 RID: 47142 RVA: 0x0028E7F4 File Offset: 0x0028C9F4
|
|
[Token(Token = "0x600B826")]
|
|
[Address(RVA = "0x1DF1A10", Offset = "0x1DF0810", VA = "0x181DF1A10")]
|
|
private void SetKey(byte[] keyBytes)
|
|
{
|
|
int num = 0;
|
|
this.workingKey = keyBytes;
|
|
this.x = num;
|
|
if (this.engineState == num)
|
|
{
|
|
byte[] array = new byte[RC4Engine.STATE_LENGTH];
|
|
this.engineState = array;
|
|
}
|
|
byte[] array2 = this.engineState;
|
|
if (num < "{il2cpp array field local5->}")
|
|
{
|
|
int length = this.engineState.Length;
|
|
byte b = (byte)((int)b + num);
|
|
byte b2;
|
|
b += b2;
|
|
byte[] array3 = this.engineState;
|
|
num++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B827 RID: 47143 RVA: 0x0028E868 File Offset: 0x0028CA68
|
|
[Token(Token = "0x600B827")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public RC4Engine()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040074C5 RID: 29893
|
|
[Token(Token = "0x40074C5")]
|
|
private static readonly int STATE_LENGTH;
|
|
|
|
// Token: 0x040074C6 RID: 29894
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40074C6")]
|
|
private byte[] engineState;
|
|
|
|
// Token: 0x040074C7 RID: 29895
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40074C7")]
|
|
private int x;
|
|
|
|
// Token: 0x040074C8 RID: 29896
|
|
[FieldOffset(Offset = "0x1C")]
|
|
[Token(Token = "0x40074C8")]
|
|
private int y;
|
|
|
|
// Token: 0x040074C9 RID: 29897
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40074C9")]
|
|
private byte[] workingKey;
|
|
}
|
|
}
|