Files
Jan2021-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Engines/NoekeonEngine.cs
T
2026-04-08 23:40:05 +02:00

335 lines
14 KiB
C#

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Cpp2IlInjected;
using Hjg.Pngcs;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x020016BC RID: 5820
[Token(Token = "0x20016BC")]
[StructLayout(3)]
public class NoekeonEngine : IBlockCipher
{
// Token: 0x06009C1C RID: 39964 RVA: 0x00235BB4 File Offset: 0x00233DB4
[Token(Token = "0x6009C1C")]
[Address(RVA = "0x2127B60", Offset = "0x2126560", VA = "0x182127B60")]
public NoekeonEngine()
{
uint[] array = new uint[4];
this.state = array;
uint[] array2 = new uint[4];
this.subKeys = array2;
uint[] array3 = new uint[4];
this.decryptKeys = array3;
this.Reset();
this._initialised = false;
}
// Token: 0x170018D6 RID: 6358
// (get) Token: 0x06009C1D RID: 39965 RVA: 0x00235BF8 File Offset: 0x00233DF8
[Token(Token = "0x170018D6")]
public virtual string AlgorithmName
{
[Token(Token = "0x6009C1D")]
[Address(RVA = "0x21285B0", Offset = "0x2126FB0", VA = "0x1821285B0", Slot = "10")]
get
{
return "Noekeon";
}
}
// Token: 0x170018D7 RID: 6359
// (get) Token: 0x06009C1E RID: 39966 RVA: 0x00235C0C File Offset: 0x00233E0C
[Token(Token = "0x170018D7")]
public virtual bool IsPartialBlockOkay
{
[Token(Token = "0x6009C1E")]
[Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "11")]
get
{
}
}
// Token: 0x06009C1F RID: 39967 RVA: 0x00235C1C File Offset: 0x00233E1C
[Token(Token = "0x6009C1F")]
[Address(RVA = "0x11B1BB0", Offset = "0x11B05B0", VA = "0x1811B1BB0", Slot = "12")]
public virtual int GetBlockSize()
{
return 16;
}
// Token: 0x06009C20 RID: 39968 RVA: 0x00235C2C File Offset: 0x00233E2C
[Token(Token = "0x6009C20")]
[Address(RVA = "0x2127760", Offset = "0x2126160", VA = "0x182127760", Slot = "13")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (06009C20)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.NoekeonEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_53:
stloc:ArgumentException(var_4_68, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("Invalid parameters passed to Noekeon 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: 0x06009C21 RID: 39969 RVA: 0x00235CA4 File Offset: 0x00233EA4
[Token(Token = "0x6009C21")]
[Address(RVA = "0x21279B0", Offset = "0x21263B0", VA = "0x1821279B0", Slot = "14")]
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
{
/*
An exception occurred when decompiling this method (06009C21)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.NoekeonEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_24:
stloc:InvalidOperationException(var_4_2A, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldloc:string(var_3)))
}
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: 0x06009C22 RID: 39970 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x6009C22")]
[Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60", Slot = "15")]
public virtual void Reset()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x06009C23 RID: 39971 RVA: 0x00235CDC File Offset: 0x00233EDC
[Token(Token = "0x6009C23")]
[Address(RVA = "0x2128720", Offset = "0x2127120", VA = "0x182128720")]
private void setKey(byte[] key)
{
uint[] array = this.subKeys;
int num = 0;
int num2 = PngHelperInternal.ReadInt4fromBytes(key, num);
array[0] = (uint)num2;
uint[] array2 = this.subKeys;
int num3 = PngHelperInternal.ReadInt4fromBytes(key, 4);
array2[0] = (uint)num3;
uint[] array3 = this.subKeys;
int num4 = PngHelperInternal.ReadInt4fromBytes(key, 8);
array3[1] = (uint)num4;
uint[] array4 = this.subKeys;
int num5 = PngHelperInternal.ReadInt4fromBytes(key, 12);
array4[1] = (uint)num5;
}
// Token: 0x06009C24 RID: 39972 RVA: 0x00235D58 File Offset: 0x00233F58
[Token(Token = "0x6009C24")]
[Address(RVA = "0x2128000", Offset = "0x2126A00", VA = "0x182128000")]
private int encryptBlock(byte[] input, int inOff, byte[] output, int outOff)
{
uint[] array = this.state;
uint[] array2 = this.state;
uint[] array3 = this.state;
uint[] array4 = this.state;
int num = 0;
uint[] array5 = this.state;
uint num2 = NoekeonEngine.roundConstants[num];
array5[0] = num2;
uint[] array6 = this.subKeys;
uint[] array7 = this.state;
this.theta(array7, array6);
uint[] array8 = this.state;
this.pi1(array8);
uint[] array9 = this.state;
this.gamma(array9);
uint[] array10 = this.state;
this.pi2(array10);
num++;
uint[] array11 = this.state;
uint num3 = NoekeonEngine.roundConstants[num];
array11[0] = num3;
uint[] array12 = this.subKeys;
uint[] array13 = this.state;
this.theta(array13, array12);
uint num4 = this.state[0];
uint num5 = this.state[0];
uint num6 = this.state[1];
uint num7 = this.state[1];
return 16;
}
// Token: 0x06009C25 RID: 39973 RVA: 0x00235E70 File Offset: 0x00234070
[Token(Token = "0x6009C25")]
[Address(RVA = "0x2127BE0", Offset = "0x21265E0", VA = "0x182127BE0")]
private int decryptBlock(byte[] input, int inOff, byte[] output, int outOff)
{
uint[] array = this.state;
uint[] array2 = this.state;
uint[] array3 = this.state;
uint[] array4 = this.state;
uint[] array5 = this.subKeys;
int length = array5.Length;
int num = 0;
uint[] array6 = this.decryptKeys;
int num2 = 0;
Array.Copy(array5, num2, array6, num, length);
uint[] array7 = this.decryptKeys;
uint[] array8 = NoekeonEngine.nullVector;
this.theta(array7, array8);
uint[] array9 = this.decryptKeys;
uint[] array10 = this.state;
this.theta(array10, array9);
uint[] array11 = this.state;
uint[] array12 = NoekeonEngine.roundConstants;
uint num3;
array11[0] = num3;
uint[] array13 = this.state;
this.pi1(array13);
uint[] array14 = this.state;
this.gamma(array14);
uint[] array15 = this.state;
this.pi2(array15);
uint[] array16 = this.decryptKeys;
uint[] array17 = this.state;
this.theta(array17, array16);
uint[] array18 = this.state;
uint[] array19 = NoekeonEngine.roundConstants;
uint num4;
array18[0] = num4;
uint num5 = this.state[0];
uint num6 = this.state[0];
uint num7 = this.state[1];
uint num8 = this.state[1];
return 16;
}
// Token: 0x06009C26 RID: 39974 RVA: 0x00235FB8 File Offset: 0x002341B8
[Token(Token = "0x6009C26")]
[Address(RVA = "0x21283A0", Offset = "0x2126DA0", VA = "0x1821283A0")]
private void gamma(uint[] a)
{
int length = a.Length;
uint num = a[1];
a[0] = num;
a[0] = num;
uint num2 = a[1];
a[1] = num;
a[0] = num2;
uint num3 = a[1];
a[1] = num3;
uint num4 = a[1];
a[0] = num4;
}
// Token: 0x06009C27 RID: 39975 RVA: 0x00236024 File Offset: 0x00234224
[Token(Token = "0x6009C27")]
[Address(RVA = "0x2128810", Offset = "0x2127210", VA = "0x182128810")]
private void theta(uint[] a, uint[] k)
{
int length = a.Length;
int num = 0;
uint num2 = k[num];
num++;
int length2 = a.Length;
}
// Token: 0x06009C28 RID: 39976 RVA: 0x00236054 File Offset: 0x00234254
[Token(Token = "0x6009C28")]
[Address(RVA = "0x21285E0", Offset = "0x2126FE0", VA = "0x1821285E0")]
private void pi1(uint[] a)
{
uint num = a[0];
num += num;
a[0] = num;
a[1] = num;
num = a[1];
a[1] = num;
}
// Token: 0x06009C29 RID: 39977 RVA: 0x00236094 File Offset: 0x00234294
[Token(Token = "0x6009C29")]
[Address(RVA = "0x2128670", Offset = "0x2127070", VA = "0x182128670")]
private void pi2(uint[] a)
{
uint num = a[0];
a[0] = num;
a[1] = num;
num = a[1];
a[1] = num;
}
// Token: 0x06009C2A RID: 39978 RVA: 0x002360D0 File Offset: 0x002342D0
[Token(Token = "0x6009C2A")]
[Address(RVA = "0x2128700", Offset = "0x2127100", VA = "0x182128700")]
private uint rotl(uint x, int y)
{
return x;
}
// Token: 0x06009C2B RID: 39979 RVA: 0x002360E0 File Offset: 0x002342E0
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x6009C2B")]
[Address(RVA = "0x2127AD0", Offset = "0x21264D0", VA = "0x182127AD0")]
static NoekeonEngine()
{
uint[] array = new uint[17];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.AF3E960D2F0572119C78CAF04B900985A299000E).FieldHandle);
NoekeonEngine.roundConstants = array;
}
// Token: 0x0400666B RID: 26219
[Token(Token = "0x400666B")]
private const int GenericSize = 16;
// Token: 0x0400666C RID: 26220
[Token(Token = "0x400666C")]
private static readonly uint[] nullVector = new uint[4];
// Token: 0x0400666D RID: 26221
[Token(Token = "0x400666D")]
private static readonly uint[] roundConstants;
// Token: 0x0400666E RID: 26222
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
[Token(Token = "0x400666E")]
private uint[] state;
// Token: 0x0400666F RID: 26223
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
[Token(Token = "0x400666F")]
private uint[] subKeys;
// Token: 0x04006670 RID: 26224
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
[Token(Token = "0x4006670")]
private uint[] decryptKeys;
// Token: 0x04006671 RID: 26225
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
[Token(Token = "0x4006671")]
private bool _initialised;
// Token: 0x04006672 RID: 26226
[global::Cpp2IlInjected.FieldOffset(Offset = "0x29")]
[Token(Token = "0x4006672")]
private bool _forEncryption;
}
}