Files
2026-04-08 23:40:05 +02:00

546 lines
33 KiB
C#

using System;
using System.Runtime.InteropServices;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x020016CF RID: 5839
[Token(Token = "0x20016CF")]
[StructLayout(3)]
public class Salsa20Engine : IStreamCipher
{
// Token: 0x06009CEE RID: 40174 RVA: 0x0023A62C File Offset: 0x0023882C
[Token(Token = "0x6009CEE")]
[Address(RVA = "0x2100580", Offset = "0x20FEF80", VA = "0x182100580")]
internal void PackTauOrSigma(int keyLength, uint[] state, int stateOffset)
{
uint num = Salsa20Engine.TAU_SIGMA[keyLength];
state[0] = num;
uint[] tau_SIGMA = Salsa20Engine.TAU_SIGMA;
int num2 = keyLength + 1;
uint num3 = tau_SIGMA[num2];
int num4 = stateOffset + 1;
state[0] = num3;
uint[] tau_SIGMA2 = Salsa20Engine.TAU_SIGMA;
uint num5;
state[0] = num5;
uint num6 = Salsa20Engine.TAU_SIGMA[keyLength];
state[0] = num6;
}
// Token: 0x06009CEF RID: 40175 RVA: 0x0023A698 File Offset: 0x00238898
[Token(Token = "0x6009CEF")]
[Address(RVA = "0x2101770", Offset = "0x2100170", VA = "0x182101770")]
public Salsa20Engine()
{
/*
An exception occurred when decompiling this method (06009CEF)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::.ctor()
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_49:
stloc:ArgumentException(var_4_53, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("'rounds' must be a positive, even number")))
}
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: 0x06009CF0 RID: 40176 RVA: 0x0023A6FC File Offset: 0x002388FC
[Token(Token = "0x6009CF0")]
[Address(RVA = "0x2101880", Offset = "0x2100280", VA = "0x182101880")]
public Salsa20Engine(int rounds)
{
/*
An exception occurred when decompiling this method (06009CF0)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::.ctor(System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_43:
stloc:ArgumentException(var_3_4D, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("'rounds' must be a positive, even number")))
}
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: 0x06009CF1 RID: 40177 RVA: 0x0023A758 File Offset: 0x00238958
[Token(Token = "0x6009CF1")]
[Address(RVA = "0x21001A0", Offset = "0x20FEBA0", VA = "0x1821001A0", Slot = "9")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (06009CF1)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_52:
stloc:InvalidOperationException(var_8_59, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldloc:string(var_7)))
}
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.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: 0x170018EF RID: 6383
// (get) Token: 0x06009CF2 RID: 40178 RVA: 0x0023A7C0 File Offset: 0x002389C0
[Token(Token = "0x170018EF")]
protected virtual int NonceSize
{
[Token(Token = "0x6009CF2")]
[Address(RVA = "0x56E570", Offset = "0x56CF70", VA = "0x18056E570", Slot = "10")]
get
{
return 8;
}
}
// Token: 0x170018F0 RID: 6384
// (get) Token: 0x06009CF3 RID: 40179 RVA: 0x0023A7D0 File Offset: 0x002389D0
[Token(Token = "0x170018F0")]
public virtual string AlgorithmName
{
[Token(Token = "0x6009CF3")]
[Address(RVA = "0x2101940", Offset = "0x2100340", VA = "0x182101940", Slot = "11")]
get
{
int num = this.rounds;
int num2 = this.rounds;
return "Salsa20" + "/" + num2;
}
}
// Token: 0x06009CF4 RID: 40180 RVA: 0x0023A7FC File Offset: 0x002389FC
[Token(Token = "0x6009CF4")]
[Address(RVA = "0x2100A60", Offset = "0x20FF460", VA = "0x182100A60", Slot = "12")]
public virtual byte ReturnByte(byte input)
{
/*
An exception occurred when decompiling this method (06009CF4)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::ReturnByte(System.Byte)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_43:
stloc:MaxBytesExceededException(var_5_4D, newobj:MaxBytesExceededException(MaxBytesExceededException::.ctor, ldstr:string("2^70 byte limit per IV; Change IV")))
}
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: 0x06009CF5 RID: 40181 RVA: 0x0023A858 File Offset: 0x00238A58
[Token(Token = "0x6009CF5")]
[Address(RVA = "0x21000A0", Offset = "0x20FEAA0", VA = "0x1821000A0", Slot = "13")]
protected virtual void AdvanceCounter()
{
if (this.engineState.Length == 8)
{
uint[] array = this.engineState;
}
}
// Token: 0x06009CF6 RID: 40182 RVA: 0x0023A880 File Offset: 0x00238A80
[Token(Token = "0x6009CF6")]
[Address(RVA = "0x2100770", Offset = "0x20FF170", VA = "0x182100770", Slot = "14")]
public virtual void ProcessBytes(byte[] inBytes, int inOff, int len, byte[] outBytes, int outOff)
{
/*
An exception occurred when decompiling this method (06009CF6)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::ProcessBytes(System.Byte[],System.Int32,System.Int32,System.Byte[],System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_75:
stloc:MaxBytesExceededException(var_10_7F, newobj:MaxBytesExceededException(MaxBytesExceededException::.ctor, ldstr:string("2^70 byte limit per IV would be exceeded; Change IV")))
}
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: 0x06009CF7 RID: 40183 RVA: 0x0023A910 File Offset: 0x00238B10
[Token(Token = "0x6009CF7")]
[Address(RVA = "0x2100A40", Offset = "0x20FF440", VA = "0x182100A40", Slot = "15")]
public virtual void Reset()
{
int num = 0;
this.index = num;
this.cW0 = (uint)num;
this.cW2 = (uint)num;
string algorithmName = ((IStreamCipher)this).AlgorithmName;
}
// Token: 0x06009CF8 RID: 40184 RVA: 0x0023A93C File Offset: 0x00238B3C
[Token(Token = "0x6009CF8")]
[Address(RVA = "0x21009D0", Offset = "0x20FF3D0", VA = "0x1821009D0", Slot = "16")]
protected virtual void ResetCounter()
{
uint[] array = this.engineState;
int num = 0;
array[4] = (uint)num;
array[4] = (uint)num;
}
// Token: 0x06009CF9 RID: 40185 RVA: 0x0023A968 File Offset: 0x00238B68
[Token(Token = "0x6009CF9")]
[Address(RVA = "0x21013B0", Offset = "0x20FFDB0", VA = "0x1821013B0", Slot = "17")]
protected virtual void SetKey(byte[] keyBytes, byte[] ivBytes)
{
if (keyBytes != 0)
{
uint[] array = this.engineState;
uint[] tau_SIGMA = Salsa20Engine.TAU_SIGMA;
uint num;
array[0] = num;
uint[] array2 = this.engineState;
uint[] tau_SIGMA2 = Salsa20Engine.TAU_SIGMA;
uint num2;
array2[2] = num2;
uint[] array3 = this.engineState;
uint[] tau_SIGMA3 = Salsa20Engine.TAU_SIGMA;
uint num3;
array3[5] = num3;
uint[] array4 = this.engineState;
uint num4 = Salsa20Engine.TAU_SIGMA[keyBytes];
array4[7] = num4;
uint[] array5 = this.engineState;
int num5 = 0;
uint num6;
ulong num7;
Pack.LE_To_UInt32(keyBytes, num5, array5, (int)num6, (int)num7);
int length = keyBytes.Length;
uint[] array6 = this.engineState;
uint num8;
ulong num9;
Pack.LE_To_UInt32(keyBytes, length, array6, (int)num8, (int)num9);
}
uint[] array7 = this.engineState;
int num10 = 0;
uint num11;
ulong num12;
Pack.LE_To_UInt32(ivBytes, num10, array7, (int)num11, (int)num12);
}
// Token: 0x06009CFA RID: 40186 RVA: 0x0023AA3C File Offset: 0x00238C3C
[Token(Token = "0x6009CFA")]
[Address(RVA = "0x2100100", Offset = "0x20FEB00", VA = "0x182100100", Slot = "18")]
protected virtual void GenerateKeyStream(byte[] output)
{
int num = this.rounds;
uint[] array = this.engineState;
uint[] array2 = this.x;
Salsa20Engine.SalsaCore(num, array, array2);
uint[] array3 = this.x;
int num2 = 0;
Pack.UInt32_To_LE(array3, output, num2);
}
// Token: 0x06009CFB RID: 40187 RVA: 0x0023AA7C File Offset: 0x00238C7C
[Token(Token = "0x6009CFB")]
[Address(RVA = "0x2100B50", Offset = "0x20FF550", VA = "0x182100B50")]
internal static void SalsaCore(int rounds, uint[] input, uint[] x)
{
int length;
do
{
length = input.Length;
}
while (length != 16 || x.Length != length || rounds != 1);
uint num = input[5];
uint num2 = input[4];
uint num3 = input[2];
uint num4 = input[3];
uint num5 = input[3];
uint num6 = input[4];
uint num7 = input[0];
uint num8 = input[6];
uint num9 = input[1];
uint num10 = input[6];
uint num11 = input[2];
uint num12 = input[7];
uint num13 = input[0];
uint num14 = input[7];
uint num15 = input[5];
uint num16 = input[1];
if (rounds > 0)
{
int num17 = rounds - 1;
num17++;
num11 += num7;
num += num14;
num += num5;
num += num15;
num += num6;
num12 += num14;
num8 += num14;
num10 += num8;
num11 = num10;
}
uint num18 = input[0];
num18 += num7;
x[0] = num18;
uint num19 = input[0];
num19 += num13;
x[0] = num19;
uint num20 = input[1];
num20 += num16;
x[1] = num20;
uint num21 = input[1];
num21 += num9;
x[1] = num21;
uint num22 = input[2];
num22 += num11;
x[2] = num22;
uint num23 = input[2];
num23 += num3;
x[2] = num23;
uint num24 = input[3];
num24 += num4;
x[3] = num24;
uint num25 = input[3];
num25 += num5;
x[3] = num25;
uint num26 = input[4];
num26 += num6;
x[4] = num26;
uint num27 = input[4];
num27 += num2;
x[4] = num27;
uint num28 = input[5];
num28 += num15;
x[5] = num28;
uint num29 = input[5];
x[5] = num29;
uint num30 = input[6];
x[6] = num30;
uint num31 = input[6];
x[6] = num31;
uint num32 = input[7];
x[7] = num32;
uint num33 = input[7];
num33 += num14;
x[7] = num33;
}
// Token: 0x06009CFC RID: 40188 RVA: 0x0023AD28 File Offset: 0x00238F28
[Token(Token = "0x6009CFC")]
[Address(RVA = "0x21009B0", Offset = "0x20FF3B0", VA = "0x1821009B0")]
internal static uint R(uint x, int y)
{
return x;
}
// Token: 0x06009CFD RID: 40189 RVA: 0x0023AD38 File Offset: 0x00238F38
[Token(Token = "0x6009CFD")]
[Address(RVA = "0x2100A30", Offset = "0x20FF430", VA = "0x182100A30")]
private void ResetLimitCounter()
{
int num = 0;
this.cW0 = (uint)num;
this.cW2 = (uint)num;
}
// Token: 0x06009CFE RID: 40190 RVA: 0x0023AD58 File Offset: 0x00238F58
[Token(Token = "0x6009CFE")]
[Address(RVA = "0x2100550", Offset = "0x20FEF50", VA = "0x182100550")]
private bool LimitExceeded()
{
/*
An exception occurred when decompiling this method (06009CFE)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::LimitExceeded()
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:uint32(var_0_06, ldfld:uint32(Salsa20Engine::cW0, ldloc:Salsa20Engine(this)))
stloc:uint32(var_0_0B, add:uint32(ldloc:uint32(var_0_06), conv.u4:uint32(ldc.i4:int32[exp:uint32](1))))
stfld:uint32(Salsa20Engine::cW0, ldloc:Salsa20Engine(this), ldloc:uint32(var_0_0B))
stloc:uint32(var_1_19, ldfld:uint32(Salsa20Engine::cW1, ldloc:Salsa20Engine(this)))
stloc:uint32(var_1_1E, add:uint32(ldloc:uint32(var_1_19), conv.u4:uint32(ldc.i4:int32[exp:uint32](1))))
stfld:uint32(Salsa20Engine::cW1, ldloc:Salsa20Engine(this), ldloc:uint32(var_1_1E))
stloc:uint32(var_2_2C, ldfld:uint32(Salsa20Engine::cW2, ldloc:Salsa20Engine(this)))
stloc:uint32(var_2_31, add:uint32(ldloc:uint32(var_2_2C), conv.u4:uint32(ldc.i4:int32[exp:uint32](1))))
stfld:uint32(Salsa20Engine::cW2, ldloc:Salsa20Engine(this), ldloc:uint32(var_2_31))
}
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: 0x06009CFF RID: 40191 RVA: 0x0023ADA0 File Offset: 0x00238FA0
[Token(Token = "0x6009CFF")]
[Address(RVA = "0x2100520", Offset = "0x20FEF20", VA = "0x182100520")]
private bool LimitExceeded(uint len)
{
/*
An exception occurred when decompiling this method (06009CFF)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.Salsa20Engine::LimitExceeded(System.UInt32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:uint32(var_0_06, ldfld:uint32(Salsa20Engine::cW0, ldloc:Salsa20Engine(this)))
stloc:uint32(var_1_0D, ldfld:uint32(Salsa20Engine::cW1, ldloc:Salsa20Engine(this)))
stloc:uint32(var_1_12, add:uint32(ldloc:uint32(var_1_0D), conv.u4:uint32(ldc.i4:int32[exp:uint32](1))))
stfld:uint32(Salsa20Engine::cW1, ldloc:Salsa20Engine(this), ldloc:uint32(var_1_12))
stloc:uint32(var_2_20, ldfld:uint32(Salsa20Engine::cW2, ldloc:Salsa20Engine(this)))
stloc:uint32(var_2_25, add:uint32(ldloc:uint32(var_2_20), conv.u4:uint32(ldc.i4:int32[exp:uint32](1))))
stfld:uint32(Salsa20Engine::cW2, ldloc:Salsa20Engine(this), ldloc:uint32(var_2_25))
}
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: 0x06009D00 RID: 40192 RVA: 0x0023ADDC File Offset: 0x00238FDC
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x6009D00")]
[Address(RVA = "0x21016C0", Offset = "0x21000C0", VA = "0x1821016C0")]
static Salsa20Engine()
{
byte[] array = Strings.ToAsciiByteArray("expand 16-byte kexpand 32-byte k");
int num = 0;
Salsa20Engine.TAU_SIGMA = Pack.LE_To_UInt32(array, num, 8);
Salsa20Engine.sigma = Strings.ToAsciiByteArray("expand 32-byte k");
Salsa20Engine.tau = Strings.ToAsciiByteArray("expand 16-byte k");
}
// Token: 0x040066D6 RID: 26326
[Token(Token = "0x40066D6")]
public static readonly int DEFAULT_ROUNDS;
// Token: 0x040066D7 RID: 26327
[Token(Token = "0x40066D7")]
private const int StateSize = 16;
// Token: 0x040066D8 RID: 26328
[Token(Token = "0x40066D8")]
private static readonly uint[] TAU_SIGMA;
// Token: 0x040066D9 RID: 26329
[Token(Token = "0x40066D9")]
[Obsolete]
protected static readonly byte[] sigma;
// Token: 0x040066DA RID: 26330
[Token(Token = "0x40066DA")]
[Obsolete]
protected static readonly byte[] tau;
// Token: 0x040066DB RID: 26331
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
[Token(Token = "0x40066DB")]
protected int rounds;
// Token: 0x040066DC RID: 26332
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
[Token(Token = "0x40066DC")]
private int index;
// Token: 0x040066DD RID: 26333
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
[Token(Token = "0x40066DD")]
internal uint[] engineState;
// Token: 0x040066DE RID: 26334
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
[Token(Token = "0x40066DE")]
internal uint[] x;
// Token: 0x040066DF RID: 26335
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
[Token(Token = "0x40066DF")]
private byte[] keyStream;
// Token: 0x040066E0 RID: 26336
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
[Token(Token = "0x40066E0")]
private bool initialised;
// Token: 0x040066E1 RID: 26337
[global::Cpp2IlInjected.FieldOffset(Offset = "0x34")]
[Token(Token = "0x40066E1")]
private uint cW0;
// Token: 0x040066E2 RID: 26338
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
[Token(Token = "0x40066E2")]
private uint cW1;
// Token: 0x040066E3 RID: 26339
[global::Cpp2IlInjected.FieldOffset(Offset = "0x3C")]
[Token(Token = "0x40066E3")]
private uint cW2;
}
}