168 lines
6.5 KiB
C#
168 lines
6.5 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x02001D7D RID: 7549
|
|
[Token(Token = "0x2001D7D")]
|
|
public class RC4Engine : IStreamCipher
|
|
{
|
|
// Token: 0x0600BBEF RID: 48111 RVA: 0x00297794 File Offset: 0x00295994
|
|
[Token(Token = "0x600BBEF")]
|
|
[Address(RVA = "0x272E1F0", Offset = "0x272D1F0", VA = "0x18272E1F0", Slot = "9")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BBEF)
|
|
|
|
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 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x17001D7B RID: 7547
|
|
// (get) Token: 0x0600BBF0 RID: 48112 RVA: 0x002977D8 File Offset: 0x002959D8
|
|
[Token(Token = "0x17001D7B")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600BBF0")]
|
|
[Address(RVA = "0x272E9D0", Offset = "0x272D9D0", VA = "0x18272E9D0", Slot = "10")]
|
|
get
|
|
{
|
|
return "RC4";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BBF1 RID: 48113 RVA: 0x002977EC File Offset: 0x002959EC
|
|
[Token(Token = "0x600BBF1")]
|
|
[Address(RVA = "0x272E600", Offset = "0x272D600", VA = "0x18272E600", 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: 0x0600BBF2 RID: 48114 RVA: 0x00297864 File Offset: 0x00295A64
|
|
[Token(Token = "0x600BBF2")]
|
|
[Address(RVA = "0x272E380", Offset = "0x272D380", VA = "0x18272E380", 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: 0x0600BBF3 RID: 48115 RVA: 0x002978EC File Offset: 0x00295AEC
|
|
[Token(Token = "0x600BBF3")]
|
|
[Address(RVA = "0x272E5F0", Offset = "0x272D5F0", VA = "0x18272E5F0", Slot = "13")]
|
|
public virtual void Reset()
|
|
{
|
|
byte[] array = this.workingKey;
|
|
this.SetKey(array);
|
|
}
|
|
|
|
// Token: 0x0600BBF4 RID: 48116 RVA: 0x00297908 File Offset: 0x00295B08
|
|
[Token(Token = "0x600BBF4")]
|
|
[Address(RVA = "0x272E770", Offset = "0x272D770", VA = "0x18272E770")]
|
|
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: 0x0600BBF5 RID: 48117 RVA: 0x0029797C File Offset: 0x00295B7C
|
|
[Token(Token = "0x600BBF5")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public RC4Engine()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400767E RID: 30334
|
|
[Token(Token = "0x400767E")]
|
|
private static readonly int STATE_LENGTH;
|
|
|
|
// Token: 0x0400767F RID: 30335
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400767F")]
|
|
private byte[] engineState;
|
|
|
|
// Token: 0x04007680 RID: 30336
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007680")]
|
|
private int x;
|
|
|
|
// Token: 0x04007681 RID: 30337
|
|
[FieldOffset(Offset = "0x1C")]
|
|
[Token(Token = "0x4007681")]
|
|
private int y;
|
|
|
|
// Token: 0x04007682 RID: 30338
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007682")]
|
|
private byte[] workingKey;
|
|
}
|
|
}
|