Files
Apr2020-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Engines/SeedEngine.cs
T
niko 8fc35183db a
2026-04-11 22:19:20 +02:00

312 lines
14 KiB
C#

using System;
using System.Runtime.CompilerServices;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001CA8 RID: 7336
[Token(Token = "0x2001CA8")]
public class SeedEngine : IBlockCipher
{
// Token: 0x0600B89A RID: 47258 RVA: 0x002910B4 File Offset: 0x0028F2B4
[Token(Token = "0x600B89A")]
[Address(RVA = "0x1DFE830", Offset = "0x1DFD630", VA = "0x181DFE830", Slot = "10")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
do
{
this.forEncryption = forEncryption;
}
while (parameters == 0 || parameters == 0);
byte[] array2;
int[] array = this.createWorkingKey(array2);
this.wKey = array;
}
// Token: 0x17001CEC RID: 7404
// (get) Token: 0x0600B89B RID: 47259 RVA: 0x002910EC File Offset: 0x0028F2EC
[Token(Token = "0x17001CEC")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B89B")]
[Address(RVA = "0x1DFF0D0", Offset = "0x1DFDED0", VA = "0x181DFF0D0", Slot = "11")]
get
{
return "SEED";
}
}
// Token: 0x17001CED RID: 7405
// (get) Token: 0x0600B89C RID: 47260 RVA: 0x00291100 File Offset: 0x0028F300
[Token(Token = "0x17001CED")]
public virtual bool IsPartialBlockOkay
{
[Token(Token = "0x600B89C")]
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "12")]
get
{
}
}
// Token: 0x0600B89D RID: 47261 RVA: 0x00291110 File Offset: 0x0028F310
[Token(Token = "0x600B89D")]
[Address(RVA = "0x4B6B10", Offset = "0x4B5910", VA = "0x1804B6B10", Slot = "13")]
public virtual int GetBlockSize()
{
return 16;
}
// Token: 0x0600B89E RID: 47262 RVA: 0x00291120 File Offset: 0x0028F320
[Token(Token = "0x600B89E")]
[Address(RVA = "0x1DFE930", Offset = "0x1DFD730", VA = "0x181DFE930", Slot = "14")]
public virtual int ProcessBlock(byte[] inBuf, int inOff, byte[] outBuf, int outOff)
{
/*
An exception occurred when decompiling this method (0600B89E)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.SeedEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_B1:
stloc:InvalidOperationException(var_18_BB, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("SEED 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.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: 0x0600B89F RID: 47263 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B89F")]
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080", Slot = "15")]
public virtual void Reset()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600B8A0 RID: 47264 RVA: 0x002911EC File Offset: 0x0028F3EC
[Token(Token = "0x600B8A0")]
[Address(RVA = "0x1DFEE00", Offset = "0x1DFDC00", VA = "0x181DFEE00")]
private int[] createWorkingKey(byte[] inKey)
{
int[] array = new int[32];
int i = 0;
int length = inKey.Length;
i++;
byte b;
i += (int)b;
while (i <= 7)
{
}
i += 8;
i++;
byte b2 = (byte)((int)b2 + i);
while (i <= 7)
{
}
uint[] kc = SeedEngine.KC;
b2 = (byte)((int)b2 + i);
int num = this.G((int)b2);
array[0] = num;
uint[] kc2 = SeedEngine.KC;
i++;
int num2;
array[0] = num2;
if (i != 1)
{
}
i++;
i += 2;
return array;
}
// Token: 0x0600B8A1 RID: 47265 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B8A1")]
[Address(RVA = "0x7A2180", Offset = "0x7A0F80", VA = "0x1807A2180")]
private int extractW1(long lVal)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600B8A2 RID: 47266 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B8A2")]
[Address(RVA = "0x1DFF0C0", Offset = "0x1DFDEC0", VA = "0x181DFF0C0")]
private int extractW0(long lVal)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600B8A3 RID: 47267 RVA: 0x00291270 File Offset: 0x0028F470
[Token(Token = "0x600B8A3")]
[Address(RVA = "0x1DFF210", Offset = "0x1DFE010", VA = "0x181DFF210")]
private long rotateLeft8(long x)
{
return x;
}
// Token: 0x0600B8A4 RID: 47268 RVA: 0x00291280 File Offset: 0x0028F480
[Token(Token = "0x600B8A4")]
[Address(RVA = "0x1DFF220", Offset = "0x1DFE020", VA = "0x181DFF220")]
private long rotateRight8(long x)
{
return x;
}
// Token: 0x0600B8A5 RID: 47269 RVA: 0x00291290 File Offset: 0x0028F490
[Token(Token = "0x600B8A5")]
[Address(RVA = "0x1DFEDA0", Offset = "0x1DFDBA0", VA = "0x181DFEDA0")]
private long bytesToLong(byte[] src, int srcOff)
{
int num = 0;
byte b;
num += (int)b;
while (srcOff <= 7)
{
}
throw new NullReferenceException();
}
// Token: 0x0600B8A6 RID: 47270 RVA: 0x002912AC File Offset: 0x0028F4AC
[Token(Token = "0x600B8A6")]
[Address(RVA = "0x1DFF100", Offset = "0x1DFDF00", VA = "0x181DFF100")]
private void longToBytes(byte[] dest, int destOff, long value)
{
}
// Token: 0x0600B8A7 RID: 47271 RVA: 0x002912C0 File Offset: 0x0028F4C0
[Token(Token = "0x600B8A7")]
[Address(RVA = "0x1DFE710", Offset = "0x1DFD510", VA = "0x181DFE710")]
private int G(int x)
{
uint[] ss = SeedEngine.SS0;
uint[] ss2 = SeedEngine.SS1;
uint[] ss3 = SeedEngine.SS2;
uint num = SeedEngine.SS3[x];
throw new NullReferenceException();
}
// Token: 0x0600B8A8 RID: 47272 RVA: 0x002912F0 File Offset: 0x0028F4F0
[Token(Token = "0x600B8A8")]
[Address(RVA = "0x1DFE640", Offset = "0x1DFD440", VA = "0x181DFE640")]
private long F(int ki0, int ki1, long r)
{
/*
An exception occurred when decompiling this method (0600B8A8)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int64 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.SeedEngine::F(System.Int32,System.Int32,System.Int64)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:int32(var_0_07, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_1_0F, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_2_17, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_1_1F, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_3_27, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_4_2F, call:int32(SeedEngine::G, ldloc:SeedEngine(this), ldloc:int64[exp:int32](r)))
stloc:int32(var_4_35, add:int32(ldloc:int32(var_4_2F), ldloc:int32(var_1_1F)))
}
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: 0x0600B8A9 RID: 47273 RVA: 0x00291334 File Offset: 0x0028F534
[Token(Token = "0x600B8A9")]
[Address(RVA = "0x1DFF160", Offset = "0x1DFDF60", VA = "0x181DFF160")]
private int phaseCalc1(int r0, int ki0, int r1, int ki1)
{
int num = this.G(r0);
return this.G(r0);
}
// Token: 0x0600B8AA RID: 47274 RVA: 0x00291350 File Offset: 0x0028F550
[Token(Token = "0x600B8AA")]
[Address(RVA = "0x1DFF1A0", Offset = "0x1DFDFA0", VA = "0x181DFF1A0")]
private int phaseCalc2(int r0, int ki0, int r1, int ki1)
{
int num = this.G(r0);
int num2 = this.G(r0);
int num3 = this.G(r0);
return this.G(r0);
}
// Token: 0x0600B8AB RID: 47275 RVA: 0x0029137C File Offset: 0x0028F57C
[Token(Token = "0x600B8AB")]
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
public SeedEngine()
{
this.Reset();
}
// Token: 0x0600B8AC RID: 47276 RVA: 0x00291390 File Offset: 0x0028F590
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600B8AC")]
[Address(RVA = "0x1DFEC60", Offset = "0x1DFDA60", VA = "0x181DFEC60")]
static SeedEngine()
{
uint[] array = new uint[256];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.D9642D3FF9879EC5C4BB28AE7001CEE3D43956AB).FieldHandle);
SeedEngine.SS0 = array;
uint[] array2 = new uint[256];
RuntimeHelpers.InitializeArray(array2, fieldof(<PrivateImplementationDetails>.8C7FEE53346CDB1B119FCAD8D605F476400A03CE).FieldHandle);
SeedEngine.SS1 = array2;
uint[] array3 = new uint[256];
RuntimeHelpers.InitializeArray(array3, fieldof(<PrivateImplementationDetails>.EEDBCB52C67688DE5F5FD9209E8A25BC786A2430).FieldHandle);
SeedEngine.SS2 = array3;
uint[] array4 = new uint[256];
RuntimeHelpers.InitializeArray(array4, fieldof(<PrivateImplementationDetails>.F8AB5CA414AD9084F3E8B8D887217E6DFC32C62C).FieldHandle);
SeedEngine.SS3 = array4;
uint[] array5 = new uint[16];
RuntimeHelpers.InitializeArray(array5, fieldof(<PrivateImplementationDetails>.641D0D9E9CE6DDAC3F12536417A6A64C8DDD4776).FieldHandle);
SeedEngine.KC = array5;
}
// Token: 0x04007506 RID: 29958
[Token(Token = "0x4007506")]
private const int BlockSize = 16;
// Token: 0x04007507 RID: 29959
[Token(Token = "0x4007507")]
private static readonly uint[] SS0;
// Token: 0x04007508 RID: 29960
[Token(Token = "0x4007508")]
private static readonly uint[] SS1;
// Token: 0x04007509 RID: 29961
[Token(Token = "0x4007509")]
private static readonly uint[] SS2;
// Token: 0x0400750A RID: 29962
[Token(Token = "0x400750A")]
private static readonly uint[] SS3;
// Token: 0x0400750B RID: 29963
[Token(Token = "0x400750B")]
private static readonly uint[] KC;
// Token: 0x0400750C RID: 29964
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400750C")]
private int[] wKey;
// Token: 0x0400750D RID: 29965
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400750D")]
private bool forEncryption;
}
}