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

349 lines
14 KiB
C#

using System;
using System.Runtime.CompilerServices;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001C99 RID: 7321
[Token(Token = "0x2001C99")]
public class NoekeonEngine : IBlockCipher
{
// Token: 0x0600B7F6 RID: 47094 RVA: 0x0028D264 File Offset: 0x0028B464
[Token(Token = "0x600B7F6")]
[Address(RVA = "0x1DD53E0", Offset = "0x1DD41E0", VA = "0x181DD53E0")]
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: 0x17001CD7 RID: 7383
// (get) Token: 0x0600B7F7 RID: 47095 RVA: 0x0028D2A8 File Offset: 0x0028B4A8
[Token(Token = "0x17001CD7")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B7F7")]
[Address(RVA = "0x1DD5E30", Offset = "0x1DD4C30", VA = "0x181DD5E30", Slot = "10")]
get
{
return "Noekeon";
}
}
// Token: 0x17001CD8 RID: 7384
// (get) Token: 0x0600B7F8 RID: 47096 RVA: 0x0028D2BC File Offset: 0x0028B4BC
[Token(Token = "0x17001CD8")]
public virtual bool IsPartialBlockOkay
{
[Token(Token = "0x600B7F8")]
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "11")]
get
{
}
}
// Token: 0x0600B7F9 RID: 47097 RVA: 0x0028D2CC File Offset: 0x0028B4CC
[Token(Token = "0x600B7F9")]
[Address(RVA = "0x4B6B10", Offset = "0x4B5910", VA = "0x1804B6B10", Slot = "12")]
public virtual int GetBlockSize()
{
return 16;
}
// Token: 0x0600B7FA RID: 47098 RVA: 0x0028D2DC File Offset: 0x0028B4DC
[Token(Token = "0x600B7FA")]
[Address(RVA = "0x1DD4FE0", Offset = "0x1DD3DE0", VA = "0x181DD4FE0", Slot = "13")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B7FA)
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_94:
stloc:ArgumentException(var_13_AA, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("Invalid parameters passed to Noekeon init - "), ldloc:string(var_12)), 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: 0x0600B7FB RID: 47099 RVA: 0x0028D394 File Offset: 0x0028B594
[Token(Token = "0x600B7FB")]
[Address(RVA = "0x1DD5230", Offset = "0x1DD4030", VA = "0x181DD5230", Slot = "14")]
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
{
/*
An exception occurred when decompiling this method (0600B7FB)
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: 0x0600B7FC RID: 47100 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B7FC")]
[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: 0x0600B7FD RID: 47101 RVA: 0x0028D3CC File Offset: 0x0028B5CC
[Token(Token = "0x600B7FD")]
[Address(RVA = "0x1DD5F80", Offset = "0x1DD4D80", VA = "0x181DD5F80")]
private void setKey(byte[] key)
{
uint[] array = this.subKeys;
int num = 0;
uint num2 = Pack.BE_To_UInt32(key, num);
array[0] = num2;
uint[] array2 = this.subKeys;
uint num3 = Pack.BE_To_UInt32(key, 4);
array2[0] = num3;
uint[] array3 = this.subKeys;
uint num4 = Pack.BE_To_UInt32(key, 8);
array3[1] = num4;
uint[] array4 = this.subKeys;
uint num5 = Pack.BE_To_UInt32(key, 12);
array4[1] = num5;
}
// Token: 0x0600B7FE RID: 47102 RVA: 0x0028D448 File Offset: 0x0028B648
[Token(Token = "0x600B7FE")]
[Address(RVA = "0x1DD5880", Offset = "0x1DD4680", VA = "0x181DD5880")]
private int encryptBlock(byte[] input, int inOff, byte[] output, int outOff)
{
uint[] array = this.state;
uint num = Pack.BE_To_UInt32(input, inOff);
array[0] = num;
uint[] array2 = this.state;
uint num2 = Pack.BE_To_UInt32(input, inOff);
array2[0] = num2;
uint[] array3 = this.state;
uint num3 = Pack.BE_To_UInt32(input, inOff);
array3[1] = num3;
uint[] array4 = this.state;
uint num4 = Pack.BE_To_UInt32(input, inOff);
array4[1] = num4;
int num5 = 0;
uint[] array5 = this.state;
uint num6 = NoekeonEngine.roundConstants[num5];
array5[0] = num6;
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);
num5++;
uint[] array11 = this.state;
uint num7 = NoekeonEngine.roundConstants[num5];
array11[0] = num7;
uint[] array12 = this.subKeys;
uint[] array13 = this.state;
this.theta(array13, array12);
uint num8 = this.state[0];
uint num9 = this.state[0];
uint num10 = this.state[1];
uint num11 = this.state[1];
return 16;
}
// Token: 0x0600B7FF RID: 47103 RVA: 0x0028D5A8 File Offset: 0x0028B7A8
[Token(Token = "0x600B7FF")]
[Address(RVA = "0x1DD5460", Offset = "0x1DD4260", VA = "0x181DD5460")]
private int decryptBlock(byte[] input, int inOff, byte[] output, int outOff)
{
uint[] array = this.state;
uint num = Pack.BE_To_UInt32(input, inOff);
array[0] = num;
uint[] array2 = this.state;
uint num2 = Pack.BE_To_UInt32(input, inOff);
array2[0] = num2;
uint[] array3 = this.state;
uint num3 = Pack.BE_To_UInt32(input, inOff);
array3[1] = num3;
uint[] array4 = this.state;
uint num4 = Pack.BE_To_UInt32(input, inOff);
array4[1] = num4;
uint[] array5 = this.subKeys;
int length = array5.Length;
int num5 = 0;
uint[] array6 = this.decryptKeys;
int num6 = 0;
Array.Copy(array5, num6, array6, num5, 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 num7;
array11[0] = num7;
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 num8;
array18[0] = num8;
uint num9 = this.state[0];
uint num10 = this.state[0];
uint num11 = this.state[1];
uint num12 = this.state[1];
return 16;
}
// Token: 0x0600B800 RID: 47104 RVA: 0x0028D738 File Offset: 0x0028B938
[Token(Token = "0x600B800")]
[Address(RVA = "0x1DD5C20", Offset = "0x1DD4A20", VA = "0x181DD5C20")]
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: 0x0600B801 RID: 47105 RVA: 0x0028D7A4 File Offset: 0x0028B9A4
[Token(Token = "0x600B801")]
[Address(RVA = "0x1DD6070", Offset = "0x1DD4E70", VA = "0x181DD6070")]
private void theta(uint[] a, uint[] k)
{
int length = a.Length;
int num = 0;
uint num2 = k[num];
num++;
int length2 = a.Length;
}
// Token: 0x0600B802 RID: 47106 RVA: 0x0028D7D4 File Offset: 0x0028B9D4
[Token(Token = "0x600B802")]
[Address(RVA = "0x1DD5E60", Offset = "0x1DD4C60", VA = "0x181DD5E60")]
private void pi1(uint[] a)
{
uint num = a[0];
num += num;
a[0] = num;
a[1] = num;
num = a[1];
a[1] = num;
}
// Token: 0x0600B803 RID: 47107 RVA: 0x0028D814 File Offset: 0x0028BA14
[Token(Token = "0x600B803")]
[Address(RVA = "0x1DD5EF0", Offset = "0x1DD4CF0", VA = "0x181DD5EF0")]
private void pi2(uint[] a)
{
uint num = a[0];
a[0] = num;
a[1] = num;
num = a[1];
a[1] = num;
}
// Token: 0x0600B804 RID: 47108 RVA: 0x0028D850 File Offset: 0x0028BA50
[Token(Token = "0x600B804")]
[Address(RVA = "0x1B445B0", Offset = "0x1B433B0", VA = "0x181B445B0")]
private uint rotl(uint x, int y)
{
return x;
}
// Token: 0x0600B805 RID: 47109 RVA: 0x0028D860 File Offset: 0x0028BA60
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600B805")]
[Address(RVA = "0x1DD5350", Offset = "0x1DD4150", VA = "0x181DD5350")]
static NoekeonEngine()
{
uint[] array = new uint[17];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.AF3E960D2F0572119C78CAF04B900985A299000E).FieldHandle);
NoekeonEngine.roundConstants = array;
}
// Token: 0x040074AE RID: 29870
[Token(Token = "0x40074AE")]
private const int GenericSize = 16;
// Token: 0x040074AF RID: 29871
[Token(Token = "0x40074AF")]
private static readonly uint[] nullVector = new uint[4];
// Token: 0x040074B0 RID: 29872
[Token(Token = "0x40074B0")]
private static readonly uint[] roundConstants;
// Token: 0x040074B1 RID: 29873
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40074B1")]
private uint[] state;
// Token: 0x040074B2 RID: 29874
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40074B2")]
private uint[] subKeys;
// Token: 0x040074B3 RID: 29875
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40074B3")]
private uint[] decryptKeys;
// Token: 0x040074B4 RID: 29876
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40074B4")]
private bool _initialised;
// Token: 0x040074B5 RID: 29877
[FieldOffset(Offset = "0x29")]
[Token(Token = "0x40074B5")]
private bool _forEncryption;
}
}