Files
Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Engines/HC128Engine.cs
T
2026-04-10 22:50:51 +02:00

344 lines
17 KiB
C#

using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001C93 RID: 7315
[Token(Token = "0x2001C93")]
public class HC128Engine : IStreamCipher
{
// Token: 0x0600B7AB RID: 47019 RVA: 0x0028B354 File Offset: 0x00289554
[Token(Token = "0x600B7AB")]
[Address(RVA = "0x1DCE330", Offset = "0x1DCD130", VA = "0x181DCE330")]
private static uint F1(uint x)
{
return x;
}
// Token: 0x0600B7AC RID: 47020 RVA: 0x0028B364 File Offset: 0x00289564
[Token(Token = "0x600B7AC")]
[Address(RVA = "0x1DCE360", Offset = "0x1DCD160", VA = "0x181DCE360")]
private static uint F2(uint x)
{
return x;
}
// Token: 0x0600B7AD RID: 47021 RVA: 0x0028B374 File Offset: 0x00289574
[Token(Token = "0x600B7AD")]
[Address(RVA = "0x1DCE390", Offset = "0x1DCD190", VA = "0x181DCE390")]
private uint G1(uint x, uint y, uint z)
{
return x;
}
// Token: 0x0600B7AE RID: 47022 RVA: 0x0028B384 File Offset: 0x00289584
[Token(Token = "0x600B7AE")]
[Address(RVA = "0x1DCE3C0", Offset = "0x1DCD1C0", VA = "0x181DCE3C0")]
private uint G2(uint x, uint y, uint z)
{
return x;
}
// Token: 0x0600B7AF RID: 47023 RVA: 0x0028B394 File Offset: 0x00289594
[Token(Token = "0x600B7AF")]
[Address(RVA = "0x1B45B80", Offset = "0x1B44980", VA = "0x181B45B80")]
private static uint RotateLeft(uint x, int bits)
{
return x;
}
// Token: 0x0600B7B0 RID: 47024 RVA: 0x0028B3A4 File Offset: 0x002895A4
[Token(Token = "0x600B7B0")]
[Address(RVA = "0x1A607B0", Offset = "0x1A5F5B0", VA = "0x181A607B0")]
private static uint RotateRight(uint x, int bits)
{
return x;
}
// Token: 0x0600B7B1 RID: 47025 RVA: 0x0028B3B4 File Offset: 0x002895B4
[Token(Token = "0x600B7B1")]
[Address(RVA = "0x1DCE460", Offset = "0x1DCD260", VA = "0x181DCE460")]
private uint H1(uint x)
{
uint[] array = this.q;
int length = array.Length;
uint num = array[(int)x];
uint num2 = array[(int)x];
return num2 + num;
}
// Token: 0x0600B7B2 RID: 47026 RVA: 0x0028B3EC File Offset: 0x002895EC
[Token(Token = "0x600B7B2")]
[Address(RVA = "0x1DCE4D0", Offset = "0x1DCD2D0", VA = "0x181DCE4D0")]
private uint H2(uint x)
{
uint[] array = this.p;
int length = array.Length;
uint num = array[(int)x];
uint num2 = array[(int)x];
return num2 + num;
}
// Token: 0x0600B7B3 RID: 47027 RVA: 0x0028B424 File Offset: 0x00289624
[Token(Token = "0x600B7B3")]
[Address(RVA = "0x1DCEC70", Offset = "0x1DCDA70", VA = "0x181DCEC70")]
private static uint Mod1024(uint x)
{
return x;
}
// Token: 0x0600B7B4 RID: 47028 RVA: 0x0028B434 File Offset: 0x00289634
[Token(Token = "0x600B7B4")]
[Address(RVA = "0x1DCEC80", Offset = "0x1DCDA80", VA = "0x181DCEC80")]
private static uint Mod512(uint x)
{
return x;
}
// Token: 0x0600B7B5 RID: 47029 RVA: 0x0028B444 File Offset: 0x00289644
[Token(Token = "0x600B7B5")]
[Address(RVA = "0x1DCE320", Offset = "0x1DCD120", VA = "0x181DCE320")]
private static uint Dim(uint x, uint y)
{
return x;
}
// Token: 0x0600B7B6 RID: 47030 RVA: 0x0028B454 File Offset: 0x00289654
[Token(Token = "0x600B7B6")]
[Address(RVA = "0x1DCEF00", Offset = "0x1DCDD00", VA = "0x181DCEF00")]
private uint Step()
{
uint num = this.cnt;
uint[] array = this.q;
int length = array.Length;
uint num2 = num + 1U;
uint num3 = array[(int)num2];
uint num4;
num3 += num4;
uint num5;
num5 += num3;
uint[] array2 = this.q;
int length2 = array2.Length;
uint[] array3 = this.p;
int length3 = array3.Length;
num3 += (uint)256;
uint num6 = array3[(int)num3];
int length4 = array3.Length;
uint num7 = array3[(int)num6];
uint num8 = num + 1U;
uint num9 = array3[(int)num8];
uint num10;
num9 += num10;
num7 += num9;
array2.m_value = num7;
int length5 = this.p.Length;
uint[] array4 = this.q;
int length6 = array4.Length;
uint num11 = array4[(int)num9];
num9 += (uint)256;
uint num12 = array4[(int)num9];
num12 += num11;
uint num13 = this.cnt;
num13 += (uint)1;
this.cnt = num13;
return num12;
}
// Token: 0x0600B7B7 RID: 47031 RVA: 0x0028B56C File Offset: 0x0028976C
[Token(Token = "0x600B7B7")]
[Address(RVA = "0x1DCE540", Offset = "0x1DCD340", VA = "0x181DCE540")]
private void Init()
{
/*
An exception occurred when decompiling this method (0600B7B7)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC128Engine::Init()
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_12B:
stloc:ArgumentException(var_26_135, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("The key must be 128 bits long")))
}
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: 0x17001CD0 RID: 7376
// (get) Token: 0x0600B7B8 RID: 47032 RVA: 0x0028B6B0 File Offset: 0x002898B0
[Token(Token = "0x17001CD0")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B7B8")]
[Address(RVA = "0x1DCF340", Offset = "0x1DCE140", VA = "0x181DCF340", Slot = "9")]
get
{
return "HC-128";
}
}
// Token: 0x0600B7B9 RID: 47033 RVA: 0x0028B6C4 File Offset: 0x002898C4
[Token(Token = "0x600B7B9")]
[Address(RVA = "0x1DCE950", Offset = "0x1DCD750", VA = "0x181DCE950", Slot = "10")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B7B9)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC128Engine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_7B:
stloc:ArgumentException(var_12_91, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("Invalid parameter passed to HC128 init - "), ldloc:string(var_11)), 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: 0x0600B7BA RID: 47034 RVA: 0x0028B764 File Offset: 0x00289964
[Token(Token = "0x600B7BA")]
[Address(RVA = "0x1DCE3F0", Offset = "0x1DCD1F0", VA = "0x181DCE3F0")]
private byte GetByte()
{
if (this.idx == 0)
{
uint num = this.Step();
byte[] array = this.buf;
Pack.UInt32_To_LE(num, array);
}
byte[] array2 = this.buf;
int num2 = this.idx + 1;
this.idx = num2;
byte b;
return b;
}
// Token: 0x0600B7BB RID: 47035 RVA: 0x0028B7B0 File Offset: 0x002899B0
[Token(Token = "0x600B7BB")]
[Address(RVA = "0x1DCEC90", Offset = "0x1DCDA90", VA = "0x181DCEC90", Slot = "11")]
public virtual void ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff)
{
/*
An exception occurred when decompiling this method (0600B7BB)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC128Engine::ProcessBytes(System.Byte[],System.Int32,System.Int32,System.Byte[],System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_54:
stloc:InvalidOperationException(var_7_5B, 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: 0x0600B7BC RID: 47036 RVA: 0x0028B81C File Offset: 0x00289A1C
[Token(Token = "0x600B7BC")]
[Address(RVA = "0x1DCEE70", Offset = "0x1DCDC70", VA = "0x181DCEE70", Slot = "12")]
public virtual void Reset()
{
this.Init();
}
// Token: 0x0600B7BD RID: 47037 RVA: 0x0028B830 File Offset: 0x00289A30
[Token(Token = "0x600B7BD")]
[Address(RVA = "0x1DCEE80", Offset = "0x1DCDC80", VA = "0x181DCEE80", Slot = "13")]
public virtual byte ReturnByte(byte input)
{
if (this.idx == 0)
{
uint num = this.Step();
byte[] array = this.buf;
Pack.UInt32_To_LE(num, array);
}
byte[] array2 = this.buf;
int num2 = this.idx + 1;
this.idx = num2;
byte b;
return b;
}
// Token: 0x0600B7BE RID: 47038 RVA: 0x0028B87C File Offset: 0x00289A7C
[Token(Token = "0x600B7BE")]
[Address(RVA = "0x1DCF2C0", Offset = "0x1DCE0C0", VA = "0x181DCF2C0")]
public HC128Engine()
{
uint[] array = new uint[512];
this.p = array;
uint[] array2 = new uint[512];
this.q = array2;
byte[] array3 = new byte[4];
this.buf = array3;
base..ctor();
}
// Token: 0x04007483 RID: 29827
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007483")]
private uint[] p;
// Token: 0x04007484 RID: 29828
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007484")]
private uint[] q;
// Token: 0x04007485 RID: 29829
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007485")]
private uint cnt;
// Token: 0x04007486 RID: 29830
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007486")]
private byte[] key;
// Token: 0x04007487 RID: 29831
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007487")]
private byte[] iv;
// Token: 0x04007488 RID: 29832
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007488")]
private bool initialised;
// Token: 0x04007489 RID: 29833
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007489")]
private byte[] buf;
// Token: 0x0400748A RID: 29834
[FieldOffset(Offset = "0x48")]
[Token(Token = "0x400748A")]
private int idx;
}
}