Files
2026-04-10 22:50:51 +02:00

336 lines
13 KiB
C#

using System;
using System.Runtime.Serialization.Formatters.Binary;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001C95 RID: 7317
[Token(Token = "0x2001C95")]
public class IsaacEngine : IStreamCipher
{
// Token: 0x0600B7C9 RID: 47049 RVA: 0x0028BE10 File Offset: 0x0028A010
[Token(Token = "0x600B7C9")]
[Address(RVA = "0x1DD2910", Offset = "0x1DD1710", VA = "0x181DD2910", Slot = "9")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B7C9)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.IsaacEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_18:
stloc:ArgumentException(var_4_2D, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to ISAAC Init - "), ldloc:string(var_3)), ldstr:string("parameters")))
}
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: 0x0600B7CA RID: 47050 RVA: 0x0028BE4C File Offset: 0x0028A04C
[Token(Token = "0x600B7CA")]
[Address(RVA = "0x1DD2C50", Offset = "0x1DD1A50", VA = "0x181DD2C50", Slot = "10")]
public virtual byte ReturnByte(byte input)
{
if (this.index == 0)
{
this.isaac();
byte[] array = Pack.UInt32_To_BE(this.results);
this.keyStream = array;
}
byte[] array2 = this.keyStream;
int num = this.index + 1;
this.index = num;
byte b;
return b;
}
// Token: 0x0600B7CB RID: 47051 RVA: 0x0028BE9C File Offset: 0x0028A09C
[Token(Token = "0x600B7CB")]
[Address(RVA = "0x1DD2A60", Offset = "0x1DD1860", VA = "0x181DD2A60", Slot = "11")]
public virtual void ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff)
{
/*
An exception occurred when decompiling this method (0600B7CB)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.IsaacEngine::ProcessBytes(System.Byte[],System.Int32,System.Int32,System.Byte[],System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_63:
stloc:InvalidOperationException(var_7_6A, newobj:InvalidOperationException(InvalidOperationException::.ctor, 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.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: 0x17001CD2 RID: 7378
// (get) Token: 0x0600B7CC RID: 47052 RVA: 0x0028BF14 File Offset: 0x0028A114
[Token(Token = "0x17001CD2")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B7CC")]
[Address(RVA = "0x1DD2DA0", Offset = "0x1DD1BA0", VA = "0x181DD2DA0", Slot = "12")]
get
{
return "ISAAC";
}
}
// Token: 0x0600B7CD RID: 47053 RVA: 0x0028BF28 File Offset: 0x0028A128
[Token(Token = "0x600B7CD")]
[Address(RVA = "0x1DD2C40", Offset = "0x1DD1A40", VA = "0x181DD2C40", Slot = "13")]
public virtual void Reset()
{
byte[] array = this.workingKey;
this.setKey(array);
}
// Token: 0x0600B7CE RID: 47054 RVA: 0x0028BF44 File Offset: 0x0028A144
[Token(Token = "0x600B7CE")]
[Address(RVA = "0x1DD3500", Offset = "0x1DD2300", VA = "0x181DD3500")]
private void setKey(byte[] keyBytes)
{
this.workingKey = keyBytes;
if (this.engineState == (ulong)0L)
{
uint[] array = new uint[IsaacEngine.stateArraySize];
this.engineState = array;
}
if (this.results == (ulong)0L)
{
uint[] array2 = new uint[IsaacEngine.stateArraySize];
this.results = array2;
}
int num = 0;
uint[] array3 = this.results;
uint[] array4 = this.engineState;
array3[0] = (uint)num;
array4[0] = (uint)num;
num++;
this.b = (uint)num;
this.a = (uint)num;
this.index = num;
byte[] array5 = new byte[keyBytes.Length];
int length = keyBytes.Length;
int num2 = 0;
int num3 = 0;
Array.Copy(keyBytes, num3, array5, num2, length);
if (num < array5.Length)
{
uint[] array6 = this.results;
int @int = SerializationHeaderRecord.GetInt32(array5, num);
num += 4;
array6[0] = (uint)@int;
}
uint[] array7 = new uint[IsaacEngine.sizeL];
num++;
array7[0] = (uint)((ulong)2654435769L);
this.mix(array7);
while (num != array7.Length)
{
}
num -= num;
if (num < 1)
{
uint[] array8 = this.results;
}
uint[] array9 = this.engineState;
num++;
this.mix(array7);
uint[] array10 = this.engineState;
num++;
uint num4 = array7[num];
array10[0] = num4;
num++;
this.isaac();
this.initialised = true;
}
// Token: 0x0600B7CF RID: 47055 RVA: 0x0028C0B4 File Offset: 0x0028A2B4
[Token(Token = "0x600B7CF")]
[Address(RVA = "0x1DD2DD0", Offset = "0x1DD1BD0", VA = "0x181DD2DD0")]
private void isaac()
{
uint num = this.c;
num += (uint)1;
int num2 = 0;
this.c = num;
uint[] array = this.engineState;
uint num3 = array[num2];
if (num2 != array.Length && num2 != array.Length && (num2 == array.Length || num2 == 1))
{
this.a = (uint)num2;
}
uint num4;
this.a = num4;
int length = array.Length;
uint num5 = array[(int)num3];
num5 += num4;
array.m_value = num5;
uint[] array2 = this.engineState;
uint[] array3 = this.results;
num3 = num5;
uint num6 = array2[(int)num3];
num6 += num3;
this.b = num6;
array3.m_value = num6;
num2++;
}
// Token: 0x0600B7D0 RID: 47056 RVA: 0x0028C174 File Offset: 0x0028A374
[Token(Token = "0x600B7D0")]
[Address(RVA = "0x1DD2FC0", Offset = "0x1DD1DC0", VA = "0x181DD2FC0")]
private void mix(uint[] x)
{
int length = x.Length;
uint num = x[0];
x[0] = num;
int length2 = x.Length;
uint num2 = x[0];
uint num3 = x[1];
num3 += num2;
x[0] = num3;
int length3 = x.Length;
uint num4 = x[1];
x[0] = num4;
int length4 = x.Length;
uint num5 = x[1];
uint num6 = x[1];
num6 += num5;
x[1] = num6;
int length5 = x.Length;
uint num7 = x[1];
x[1] = num7;
int length6 = x.Length;
uint num8 = x[1];
uint num9 = x[2];
num9 += num8;
x[1] = num9;
int length7 = x.Length;
uint num10 = x[2];
x[1] = num10;
int length8 = x.Length;
uint num11 = x[2];
uint num12 = x[2];
num12 += num11;
x[2] = num12;
int length9 = x.Length;
uint num13 = x[2];
x[2] = num13;
int length10 = x.Length;
uint num14 = x[2];
x[2] = num14;
int length11 = x.Length;
uint num15 = x[3];
x[2] = num15;
int length12 = x.Length;
uint num16 = x[0];
num15 += num16;
x[0] = num15;
int length13 = x.Length;
uint num17 = x[3];
x[3] = num17;
int length14 = x.Length;
uint num18 = x[3];
x[3] = num18;
int length15 = x.Length;
uint num19 = x[0];
num18 += num19;
x[0] = num18;
uint num20 = x[0];
x[3] = num20;
uint num21 = x[0];
x[3] = num21;
int length16 = x.Length;
uint num22 = x[1];
num21 += num22;
x[1] = num21;
int length17 = x.Length;
uint num23 = x[0];
x[0] = num23;
}
// Token: 0x0600B7D1 RID: 47057 RVA: 0x0028C3B4 File Offset: 0x0028A5B4
[Token(Token = "0x600B7D1")]
[Address(RVA = "0x1DD2D20", Offset = "0x1DD1B20", VA = "0x181DD2D20")]
public IsaacEngine()
{
byte[] array = new byte[IsaacEngine.stateArraySize];
this.keyStream = array;
base..ctor();
}
// Token: 0x04007493 RID: 29843
[Token(Token = "0x4007493")]
private static readonly int sizeL;
// Token: 0x04007494 RID: 29844
[Token(Token = "0x4007494")]
private static readonly int stateArraySize = IsaacEngine.sizeL;
// Token: 0x04007495 RID: 29845
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007495")]
private uint[] engineState;
// Token: 0x04007496 RID: 29846
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007496")]
private uint[] results;
// Token: 0x04007497 RID: 29847
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007497")]
private uint a;
// Token: 0x04007498 RID: 29848
[FieldOffset(Offset = "0x24")]
[Token(Token = "0x4007498")]
private uint b;
// Token: 0x04007499 RID: 29849
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007499")]
private uint c;
// Token: 0x0400749A RID: 29850
[FieldOffset(Offset = "0x2C")]
[Token(Token = "0x400749A")]
private int index;
// Token: 0x0400749B RID: 29851
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x400749B")]
private byte[] keyStream;
// Token: 0x0400749C RID: 29852
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x400749C")]
private byte[] workingKey;
// Token: 0x0400749D RID: 29853
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x400749D")]
private bool initialised;
}
}