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

259 lines
8.9 KiB
C#

using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001C9E RID: 7326
[Token(Token = "0x2001C9E")]
public class RC532Engine : IBlockCipher
{
// Token: 0x0600B829 RID: 47145 RVA: 0x0028E88C File Offset: 0x0028CA8C
[Token(Token = "0x600B829")]
[Address(RVA = "0x1DF2990", Offset = "0x1DF1790", VA = "0x181DF2990")]
public RC532Engine()
{
this.Reset();
this._noRounds = (int)((ulong)12L);
}
// Token: 0x17001CDF RID: 7391
// (get) Token: 0x0600B82A RID: 47146 RVA: 0x0028E8AC File Offset: 0x0028CAAC
[Token(Token = "0x17001CDF")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B82A")]
[Address(RVA = "0x1DF29B0", Offset = "0x1DF17B0", VA = "0x181DF29B0", Slot = "10")]
get
{
return "RC5-32";
}
}
// Token: 0x17001CE0 RID: 7392
// (get) Token: 0x0600B82B RID: 47147 RVA: 0x0028E8C0 File Offset: 0x0028CAC0
[Token(Token = "0x17001CE0")]
public virtual bool IsPartialBlockOkay
{
[Token(Token = "0x600B82B")]
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "11")]
get
{
}
}
// Token: 0x0600B82C RID: 47148 RVA: 0x0028E8D0 File Offset: 0x0028CAD0
[Token(Token = "0x600B82C")]
[Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "12")]
public virtual int GetBlockSize()
{
return 8;
}
// Token: 0x0600B82D RID: 47149 RVA: 0x0028E8E0 File Offset: 0x0028CAE0
[Token(Token = "0x600B82D")]
[Address(RVA = "0x1DF2370", Offset = "0x1DF1170", VA = "0x181DF2370", Slot = "13")]
public virtual void Init(bool forEncryption, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B82D)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC532Engine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_4A:
stloc:ArgumentException(var_8_5B, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to RC532 init - "), ldloc:string(var_7))))
}
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: 0x0600B82E RID: 47150 RVA: 0x0028E94C File Offset: 0x0028CB4C
[Token(Token = "0x600B82E")]
[Address(RVA = "0x1DF25A0", Offset = "0x1DF13A0", VA = "0x181DF25A0", Slot = "14")]
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
{
if (this.forEncryption)
{
int num;
return num;
}
int num2;
return num2;
}
// Token: 0x0600B82F RID: 47151 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B82F")]
[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: 0x0600B830 RID: 47152 RVA: 0x0028E968 File Offset: 0x0028CB68
[Token(Token = "0x600B830")]
[Address(RVA = "0x1DF2610", Offset = "0x1DF1410", VA = "0x181DF2610")]
private void SetKey(byte[] key)
{
int num = key.Length;
num += 3;
int[] array = new int[key];
int num2 = 0;
int length = key.Length;
if (num2 != length)
{
num2 += key;
num2 -= key;
num2++;
}
int[] array2 = new int[this._noRounds];
this._S = array2;
int p = RC532Engine.P32;
array2[0] = p;
int[] s = this._S;
uint num3;
int[] s2;
if (num3 < (uint)s.Length)
{
int length2 = s.Length;
uint num4 = num3 - 1U;
int num5 = s[(int)num4];
int length3 = s.Length;
num3 += (uint)1;
int num6 = RC532Engine.Q32;
num6 += num5;
s[0] = num6;
s2 = this._S;
}
int length4 = s2.Length;
if (array.Length > length4)
{
}
if (num3 > (uint)0)
{
s2[0] = 0;
int num7 = array[num2];
num7 += 0;
num7 += num2;
array[0] = num7;
int[] s3 = this._S;
num2++;
}
}
// Token: 0x0600B831 RID: 47153 RVA: 0x0028EA78 File Offset: 0x0028CC78
[Token(Token = "0x600B831")]
[Address(RVA = "0x1DF2000", Offset = "0x1DF0E00", VA = "0x181DF2000")]
private int EncryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
{
int num = this.BytesToWord(input, inOff);
int[] s = this._S;
int length = s.Length;
int num2 = s[0];
num2 += num;
int length2 = input.Length;
byte b = input[input];
num = inOff + 7;
int noRounds = this._noRounds;
uint num4;
uint num3 = num4 + 1U;
byte b2;
b = b2;
int num5 = s[(int)num3];
num5 += (int)b;
uint num6 = num3 + 1U;
num4 += (uint)1;
num3 += (uint)2;
while (num4 <= (uint)noRounds)
{
}
throw new NullReferenceException();
}
// Token: 0x0600B832 RID: 47154 RVA: 0x0028EB04 File Offset: 0x0028CD04
[Token(Token = "0x600B832")]
[Address(RVA = "0x1DF1CA0", Offset = "0x1DF0AA0", VA = "0x181DF1CA0")]
private int DecryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
{
int num = this.BytesToWord(input, inOff);
int length = input.Length;
num = inOff + 7;
int i = this._noRounds;
int length2 = this._S.Length;
byte b2;
byte b = b2 + 1;
while (i >= 1)
{
}
int[] s = this._S;
byte b3;
this._S[0] = (int)b3;
throw new NullReferenceException();
}
// Token: 0x0600B833 RID: 47155 RVA: 0x0028EB64 File Offset: 0x0028CD64
[Token(Token = "0x600B833")]
[Address(RVA = "0x1DF25D0", Offset = "0x1DF13D0", VA = "0x181DF25D0")]
private int RotateLeft(int x, int y)
{
return x;
}
// Token: 0x0600B834 RID: 47156 RVA: 0x0028EB74 File Offset: 0x0028CD74
[Token(Token = "0x600B834")]
[Address(RVA = "0x1DF25F0", Offset = "0x1DF13F0", VA = "0x181DF25F0")]
private int RotateRight(int x, int y)
{
return x;
}
// Token: 0x0600B835 RID: 47157 RVA: 0x0028EB84 File Offset: 0x0028CD84
[Token(Token = "0x600B835")]
[Address(RVA = "0x1A3E3B0", Offset = "0x1A3D1B0", VA = "0x181A3E3B0")]
private int BytesToWord(byte[] src, int srcOff)
{
int length = src.Length;
int num = srcOff + 1;
throw new NullReferenceException();
}
// Token: 0x0600B836 RID: 47158 RVA: 0x0028EBA4 File Offset: 0x0028CDA4
[Token(Token = "0x600B836")]
[Address(RVA = "0x1A3E310", Offset = "0x1A3D110", VA = "0x181A3E310")]
private void WordToBytes(int word, byte[] dst, int dstOff)
{
int num = dstOff + 1;
}
// Token: 0x040074CA RID: 29898
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40074CA")]
private int _noRounds;
// Token: 0x040074CB RID: 29899
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40074CB")]
private int[] _S;
// Token: 0x040074CC RID: 29900
[Token(Token = "0x40074CC")]
private static readonly int P32;
// Token: 0x040074CD RID: 29901
[Token(Token = "0x40074CD")]
private static readonly int Q32;
// Token: 0x040074CE RID: 29902
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40074CE")]
private bool forEncryption;
}
}