Files
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

360 lines
11 KiB
C#

using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests
{
// Token: 0x02001DDA RID: 7642
[Token(Token = "0x2001DDA")]
public class Sha512tDigest : LongDigest
{
// Token: 0x0600BF7B RID: 49019 RVA: 0x002B1478 File Offset: 0x002AF678
[Token(Token = "0x600BF7B")]
[Address(RVA = "0x290F210", Offset = "0x290E210", VA = "0x18290F210")]
public Sha512tDigest(int bitLength)
{
/*
An exception occurred when decompiling this method (0600BF7B)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests.Sha512tDigest::.ctor(System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_42:
stloc:ArgumentException(var_3_51, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("cannot be 384 use SHA384 instead"), ldstr:string("bitLength")))
}
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: 0x0600BF7C RID: 49020 RVA: 0x002B14D8 File Offset: 0x002AF6D8
[Token(Token = "0x600BF7C")]
[Address(RVA = "0x290F180", Offset = "0x290E180", VA = "0x18290F180")]
public Sha512tDigest(Sha512tDigest t)
: base(t)
{
int num = t.digestLength;
this.digestLength = num;
IMemoable memoable = ((IMemoable)this).Copy();
}
// Token: 0x17001DBF RID: 7615
// (get) Token: 0x0600BF7D RID: 49021 RVA: 0x002B1508 File Offset: 0x002AF708
[Token(Token = "0x17001DBF")]
public override string AlgorithmName
{
[Token(Token = "0x600BF7D")]
[Address(RVA = "0x290F390", Offset = "0x290E390", VA = "0x18290F390", Slot = "14")]
get
{
int num = this.digestLength;
return "SHA-512/" + num;
}
}
// Token: 0x0600BF7E RID: 49022 RVA: 0x002B1528 File Offset: 0x002AF728
[Token(Token = "0x600BF7E")]
[Address(RVA = "0x4F3F50", Offset = "0x4F2F50", VA = "0x1804F3F50", Slot = "15")]
public override int GetDigestSize()
{
return this.digestLength;
}
// Token: 0x0600BF7F RID: 49023 RVA: 0x002B153C File Offset: 0x002AF73C
[Token(Token = "0x600BF7F")]
[Address(RVA = "0x290EBB0", Offset = "0x290DBB0", VA = "0x18290EBB0", Slot = "16")]
public override int DoFinal(byte[] output, int outOff)
{
base.Finish();
int num = this.digestLength;
if (num > 0)
{
ulong h = this.H1;
Sha512tDigest.UInt32_To_BE((uint)h, output, outOff, num);
if (num > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h, output, outOff, num);
}
}
int num2 = this.digestLength;
ulong h2;
if (num2 > 0)
{
h2 = this.H2;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num2 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num3 = this.digestLength;
if (num3 > 0)
{
num2 = num3;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num3 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num4 = this.digestLength;
if (num4 > 0)
{
num2 = num4;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num4 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num5 = this.digestLength;
if (num5 > 0)
{
num2 = num5;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num5 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num6 = this.digestLength;
if (num6 > 0)
{
num2 = num6;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num6 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num7 = this.digestLength;
if (num7 > 0)
{
num2 = num7;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num7 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
int num8 = this.digestLength;
if (num8 > 0)
{
num2 = num8;
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
if (num8 > 4)
{
Sha512tDigest.UInt32_To_BE((uint)h2, output, outOff, num2);
}
}
return this.digestLength;
}
// Token: 0x0600BF80 RID: 49024 RVA: 0x002B16A0 File Offset: 0x002AF8A0
[Token(Token = "0x600BF80")]
[Address(RVA = "0x290EE60", Offset = "0x290DE60", VA = "0x18290EE60", Slot = "13")]
public override void Reset()
{
base.Reset();
ulong h1t = this.H1t;
this.H1 = h1t;
ulong h2t = this.H2t;
this.H2 = h2t;
ulong h3t = this.H3t;
this.H3 = h3t;
ulong h4t = this.H4t;
this.H4 = h4t;
ulong h5t = this.H5t;
this.H5 = h5t;
ulong h6t = this.H6t;
this.H6 = h6t;
ulong h7t = this.H7t;
this.H7 = h7t;
ulong h8t = this.H8t;
this.H8 = h8t;
}
// Token: 0x0600BF81 RID: 49025 RVA: 0x002B172C File Offset: 0x002AF92C
[Token(Token = "0x600BF81")]
[Address(RVA = "0x290F3F0", Offset = "0x290E3F0", VA = "0x18290F3F0")]
private void tIvGenerate(int bitLength)
{
ulong num;
this.H1 = num;
ulong num2;
this.H2 = num2;
ulong num3;
this.H3 = num3;
ulong num4;
this.H4 = num4;
ulong num5;
this.H5 = num5;
ulong num6;
this.H6 = num6;
ulong num7;
this.H7 = num7;
ulong num8;
this.H8 = num8;
ulong num9;
base.Update((byte)num9);
ulong num10;
base.Update((byte)num10);
ulong num11;
base.Update((byte)num11);
ulong num12;
base.Update((byte)num12);
ulong num13;
base.Update((byte)num13);
ulong num14;
base.Update((byte)num14);
ulong num15;
base.Update((byte)num15);
ulong num16;
base.Update((byte)num16);
if (bitLength > 10)
{
ulong num17;
num17 += num17;
long num18 = (long)(num17 * (ulong)((uint)100));
ulong num19;
num19 += num19;
num19 += num19;
num19 += num19;
}
base.Update((byte)num16);
base.Finish();
ulong h = this.H1;
this.H1t = h;
ulong h2 = this.H2;
this.H2t = h2;
ulong h3 = this.H3;
this.H3t = h3;
ulong h4 = this.H4;
this.H4t = h4;
ulong h5 = this.H5;
this.H5t = h5;
ulong h6 = this.H6;
this.H6t = h6;
ulong h7 = this.H7;
this.H7t = h7;
ulong h8 = this.H8;
this.H8t = h8;
}
// Token: 0x0600BF82 RID: 49026 RVA: 0x002B186C File Offset: 0x002AFA6C
[Token(Token = "0x600BF82")]
[Address(RVA = "0x290F110", Offset = "0x290E110", VA = "0x18290F110")]
private static void UInt64_To_BE(ulong n, byte[] bs, int off, int max)
{
if (max > 0)
{
Sha512tDigest.UInt32_To_BE((uint)n, bs, off, max);
if (max > 4)
{
Sha512tDigest.UInt32_To_BE((uint)n, bs, off, max);
}
}
}
// Token: 0x0600BF83 RID: 49027 RVA: 0x002B1894 File Offset: 0x002AFA94
[Token(Token = "0x600BF83")]
[Address(RVA = "0x290F030", Offset = "0x290E030", VA = "0x18290F030")]
private static void UInt32_To_BE(uint n, byte[] bs, int off, int max)
{
int num = Math.Min(4, max);
uint num2;
num2 -= (uint)num;
num2 += (uint)8;
}
// Token: 0x0600BF84 RID: 49028 RVA: 0x002B18BC File Offset: 0x002AFABC
[Token(Token = "0x600BF84")]
[Address(RVA = "0x290EAF0", Offset = "0x290DAF0", VA = "0x18290EAF0", Slot = "17")]
public override IMemoable Copy()
{
Sha512tDigest sha512tDigest = new Sha512tDigest(this);
int num = this.digestLength;
sha512tDigest.digestLength = num;
IMemoable memoable = sha512tDigest.Copy();
throw new NullReferenceException();
}
// Token: 0x0600BF85 RID: 49029 RVA: 0x002B18EC File Offset: 0x002AFAEC
[Token(Token = "0x600BF85")]
[Address(RVA = "0x290EED0", Offset = "0x290DED0", VA = "0x18290EED0", Slot = "18")]
public override void Reset(IMemoable other)
{
int num;
do
{
num = 0;
}
while (other == 0 || this.digestLength != num);
this.H1t = (ulong)num;
this.H2t = (ulong)num;
this.H3t = (ulong)num;
this.H4t = (ulong)num;
this.H5t = (ulong)num;
this.H6t = (ulong)num;
this.H7t = (ulong)num;
this.H8t = (ulong)num;
}
// Token: 0x040078F1 RID: 30961
[Token(Token = "0x40078F1")]
private const ulong A5 = 11936128518282651045UL;
// Token: 0x040078F2 RID: 30962
[FieldOffset(Offset = "0x88")]
[Token(Token = "0x40078F2")]
private readonly int digestLength;
// Token: 0x040078F3 RID: 30963
[FieldOffset(Offset = "0x90")]
[Token(Token = "0x40078F3")]
private ulong H1t;
// Token: 0x040078F4 RID: 30964
[FieldOffset(Offset = "0x98")]
[Token(Token = "0x40078F4")]
private ulong H2t;
// Token: 0x040078F5 RID: 30965
[FieldOffset(Offset = "0xA0")]
[Token(Token = "0x40078F5")]
private ulong H3t;
// Token: 0x040078F6 RID: 30966
[FieldOffset(Offset = "0xA8")]
[Token(Token = "0x40078F6")]
private ulong H4t;
// Token: 0x040078F7 RID: 30967
[FieldOffset(Offset = "0xB0")]
[Token(Token = "0x40078F7")]
private ulong H5t;
// Token: 0x040078F8 RID: 30968
[FieldOffset(Offset = "0xB8")]
[Token(Token = "0x40078F8")]
private ulong H6t;
// Token: 0x040078F9 RID: 30969
[FieldOffset(Offset = "0xC0")]
[Token(Token = "0x40078F9")]
private ulong H7t;
// Token: 0x040078FA RID: 30970
[FieldOffset(Offset = "0xC8")]
[Token(Token = "0x40078FA")]
private ulong H8t;
}
}