362 lines
11 KiB
C#
362 lines
11 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests
|
|
{
|
|
// Token: 0x0200171D RID: 5917
|
|
[Token(Token = "0x200171D")]
|
|
[StructLayout(3)]
|
|
public class Sha512tDigest : LongDigest
|
|
{
|
|
// Token: 0x06009FD3 RID: 40915 RVA: 0x00250AD0 File Offset: 0x0024ECD0
|
|
[Token(Token = "0x6009FD3")]
|
|
[Address(RVA = "0x22505F0", Offset = "0x224EFF0", VA = "0x1822505F0")]
|
|
public Sha512tDigest(int bitLength)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009FD3)
|
|
|
|
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: 0x06009FD4 RID: 40916 RVA: 0x00250B30 File Offset: 0x0024ED30
|
|
[Token(Token = "0x6009FD4")]
|
|
[Address(RVA = "0x2250560", Offset = "0x224EF60", VA = "0x182250560")]
|
|
public Sha512tDigest(Sha512tDigest t)
|
|
: base(t)
|
|
{
|
|
int num = t.digestLength;
|
|
this.digestLength = num;
|
|
IMemoable memoable = ((IMemoable)this).Copy();
|
|
}
|
|
|
|
// Token: 0x17001921 RID: 6433
|
|
// (get) Token: 0x06009FD5 RID: 40917 RVA: 0x00250B60 File Offset: 0x0024ED60
|
|
[Token(Token = "0x17001921")]
|
|
public override string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009FD5")]
|
|
[Address(RVA = "0x2250770", Offset = "0x224F170", VA = "0x182250770", Slot = "14")]
|
|
get
|
|
{
|
|
int num = this.digestLength;
|
|
return "SHA-512/" + num;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009FD6 RID: 40918 RVA: 0x00250B80 File Offset: 0x0024ED80
|
|
[Token(Token = "0x6009FD6")]
|
|
[Address(RVA = "0x54D7F0", Offset = "0x54C1F0", VA = "0x18054D7F0", Slot = "15")]
|
|
public override int GetDigestSize()
|
|
{
|
|
return this.digestLength;
|
|
}
|
|
|
|
// Token: 0x06009FD7 RID: 40919 RVA: 0x00250B94 File Offset: 0x0024ED94
|
|
[Token(Token = "0x6009FD7")]
|
|
[Address(RVA = "0x224FF90", Offset = "0x224E990", VA = "0x18224FF90", 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: 0x06009FD8 RID: 40920 RVA: 0x00250CF8 File Offset: 0x0024EEF8
|
|
[Token(Token = "0x6009FD8")]
|
|
[Address(RVA = "0x2250240", Offset = "0x224EC40", VA = "0x182250240", 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: 0x06009FD9 RID: 40921 RVA: 0x00250D84 File Offset: 0x0024EF84
|
|
[Token(Token = "0x6009FD9")]
|
|
[Address(RVA = "0x22507D0", Offset = "0x224F1D0", VA = "0x1822507D0")]
|
|
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: 0x06009FDA RID: 40922 RVA: 0x00250EC4 File Offset: 0x0024F0C4
|
|
[Token(Token = "0x6009FDA")]
|
|
[Address(RVA = "0x22504F0", Offset = "0x224EEF0", VA = "0x1822504F0")]
|
|
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: 0x06009FDB RID: 40923 RVA: 0x00250EEC File Offset: 0x0024F0EC
|
|
[Token(Token = "0x6009FDB")]
|
|
[Address(RVA = "0x2250410", Offset = "0x224EE10", VA = "0x182250410")]
|
|
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: 0x06009FDC RID: 40924 RVA: 0x00250F14 File Offset: 0x0024F114
|
|
[Token(Token = "0x6009FDC")]
|
|
[Address(RVA = "0x224FED0", Offset = "0x224E8D0", VA = "0x18224FED0", 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: 0x06009FDD RID: 40925 RVA: 0x00250F44 File Offset: 0x0024F144
|
|
[Token(Token = "0x6009FDD")]
|
|
[Address(RVA = "0x22502B0", Offset = "0x224ECB0", VA = "0x1822502B0", 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: 0x040068F5 RID: 26869
|
|
[Token(Token = "0x40068F5")]
|
|
private const ulong A5 = 11936128518282651045UL;
|
|
|
|
// Token: 0x040068F6 RID: 26870
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x88")]
|
|
[Token(Token = "0x40068F6")]
|
|
private readonly int digestLength;
|
|
|
|
// Token: 0x040068F7 RID: 26871
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x90")]
|
|
[Token(Token = "0x40068F7")]
|
|
private ulong H1t;
|
|
|
|
// Token: 0x040068F8 RID: 26872
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x98")]
|
|
[Token(Token = "0x40068F8")]
|
|
private ulong H2t;
|
|
|
|
// Token: 0x040068F9 RID: 26873
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xA0")]
|
|
[Token(Token = "0x40068F9")]
|
|
private ulong H3t;
|
|
|
|
// Token: 0x040068FA RID: 26874
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xA8")]
|
|
[Token(Token = "0x40068FA")]
|
|
private ulong H4t;
|
|
|
|
// Token: 0x040068FB RID: 26875
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xB0")]
|
|
[Token(Token = "0x40068FB")]
|
|
private ulong H5t;
|
|
|
|
// Token: 0x040068FC RID: 26876
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xB8")]
|
|
[Token(Token = "0x40068FC")]
|
|
private ulong H6t;
|
|
|
|
// Token: 0x040068FD RID: 26877
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xC0")]
|
|
[Token(Token = "0x40068FD")]
|
|
private ulong H7t;
|
|
|
|
// Token: 0x040068FE RID: 26878
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0xC8")]
|
|
[Token(Token = "0x40068FE")]
|
|
private ulong H8t;
|
|
}
|
|
}
|