using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x02001D74 RID: 7540 [Token(Token = "0x2001D74")] public class HC256Engine : IStreamCipher { // Token: 0x0600BB8D RID: 48013 RVA: 0x002949D0 File Offset: 0x00292BD0 [Token(Token = "0x600BB8D")] [Address(RVA = "0x27F2290", Offset = "0x27F1290", VA = "0x1827F2290")] private uint Step() { uint num = this.cnt; uint[] array = this.q; int length = array.Length; uint num2 = array[this]; uint num3 = num + 1U; uint num4 = array[(int)num3]; uint[] array2 = this.p; uint num5 = array[(int)num3]; num3 = num4; num3 += num5; uint[] array3 = this.q; int length2 = array3.Length; uint[] array4 = this.p; int length3 = array4.Length; num4 = num2; num4 += (uint)256; uint num6 = array4[(int)num4]; num4 = num2; num4 += (uint)512; num2 += (uint)768; uint num7 = array4[(int)num2]; uint num8 = num + 1U; uint[] array5 = this.q; array3 += num6; uint[] array6 = this.p; int length4 = array6.Length; uint[] array7 = this.q; uint num9 = array6[(int)num2]; int length5 = array7.Length; uint num10 = array7[(int)num9]; num2 = num9; num9 = num2; num9 += (uint)256; uint num11 = array7[(int)num9]; num2 = num9; num9 = num2; num9 += (uint)512; num2 = num9; num2 += (uint)768; num2 += num11; num2 += num10; uint num12 = this.cnt; num12 += (uint)1; this.cnt = num12; return num2; } // Token: 0x0600BB8E RID: 48014 RVA: 0x00294B30 File Offset: 0x00292D30 [Token(Token = "0x600BB8E")] [Address(RVA = "0x27F18A0", Offset = "0x27F08A0", VA = "0x1827F18A0")] private void Init() { /* An exception occurred when decompiling this method (0600BB8E) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC256Engine::Init() ---> System.Exception: Basic block has to end with unconditional control flow. { IL_1AF: stloc:ArgumentException(var_38_1B9, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("The key must be 128/256 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: 0x17001D6E RID: 7534 // (get) Token: 0x0600BB8F RID: 48015 RVA: 0x00294CF8 File Offset: 0x00292EF8 [Token(Token = "0x17001D6E")] public virtual string AlgorithmName { [Token(Token = "0x600BB8F")] [Address(RVA = "0x27F2810", Offset = "0x27F1810", VA = "0x1827F2810", Slot = "9")] get { return "HC-256"; } } // Token: 0x0600BB90 RID: 48016 RVA: 0x00294D0C File Offset: 0x00292F0C [Token(Token = "0x600BB90")] [Address(RVA = "0x27F1D00", Offset = "0x27F0D00", VA = "0x1827F1D00", Slot = "10")] public virtual void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (0600BB90) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC256Engine::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 HC256 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: 0x0600BB91 RID: 48017 RVA: 0x00294DAC File Offset: 0x00292FAC [Token(Token = "0x600BB91")] [Address(RVA = "0x27F1830", Offset = "0x27F0830", VA = "0x1827F1830")] 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: 0x0600BB92 RID: 48018 RVA: 0x00294DF8 File Offset: 0x00292FF8 [Token(Token = "0x600BB92")] [Address(RVA = "0x27F2020", Offset = "0x27F1020", VA = "0x1827F2020", Slot = "11")] public virtual void ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff) { /* An exception occurred when decompiling this method (0600BB92) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.HC256Engine::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: 0x0600BB93 RID: 48019 RVA: 0x00294E64 File Offset: 0x00293064 [Token(Token = "0x600BB93")] [Address(RVA = "0x27F2200", Offset = "0x27F1200", VA = "0x1827F2200", Slot = "12")] public virtual void Reset() { this.Init(); } // Token: 0x0600BB94 RID: 48020 RVA: 0x00294E78 File Offset: 0x00293078 [Token(Token = "0x600BB94")] [Address(RVA = "0x27F2210", Offset = "0x27F1210", VA = "0x1827F2210", 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: 0x0600BB95 RID: 48021 RVA: 0x00294EC4 File Offset: 0x002930C4 [Token(Token = "0x600BB95")] [Address(RVA = "0x1030AC0", Offset = "0x102FAC0", VA = "0x181030AC0")] private static uint RotateRight(uint x, int bits) { return x; } // Token: 0x0600BB96 RID: 48022 RVA: 0x00294ED4 File Offset: 0x002930D4 [Token(Token = "0x600BB96")] [Address(RVA = "0x27F2790", Offset = "0x27F1790", VA = "0x1827F2790")] public HC256Engine() { uint[] array = new uint[1024]; this.p = array; uint[] array2 = new uint[1024]; this.q = array2; byte[] array3 = new byte[4]; this.buf = array3; base..ctor(); } // Token: 0x04007644 RID: 30276 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4007644")] private uint[] p; // Token: 0x04007645 RID: 30277 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4007645")] private uint[] q; // Token: 0x04007646 RID: 30278 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4007646")] private uint cnt; // Token: 0x04007647 RID: 30279 [FieldOffset(Offset = "0x28")] [Token(Token = "0x4007647")] private byte[] key; // Token: 0x04007648 RID: 30280 [FieldOffset(Offset = "0x30")] [Token(Token = "0x4007648")] private byte[] iv; // Token: 0x04007649 RID: 30281 [FieldOffset(Offset = "0x38")] [Token(Token = "0x4007649")] private bool initialised; // Token: 0x0400764A RID: 30282 [FieldOffset(Offset = "0x40")] [Token(Token = "0x400764A")] private byte[] buf; // Token: 0x0400764B RID: 30283 [FieldOffset(Offset = "0x48")] [Token(Token = "0x400764B")] private int idx; } }