360 lines
11 KiB
C#
360 lines
11 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests
|
|
{
|
|
// Token: 0x02001CFA RID: 7418
|
|
[Token(Token = "0x2001CFA")]
|
|
public class Sha512tDigest : LongDigest
|
|
{
|
|
// Token: 0x0600BBAD RID: 48045 RVA: 0x002A8BC0 File Offset: 0x002A6DC0
|
|
[Token(Token = "0x600BBAD")]
|
|
[Address(RVA = "0x1FE2580", Offset = "0x1FE1380", VA = "0x181FE2580")]
|
|
public Sha512tDigest(int bitLength)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BBAD)
|
|
|
|
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: 0x0600BBAE RID: 48046 RVA: 0x002A8C20 File Offset: 0x002A6E20
|
|
[Token(Token = "0x600BBAE")]
|
|
[Address(RVA = "0x1FE24F0", Offset = "0x1FE12F0", VA = "0x181FE24F0")]
|
|
public Sha512tDigest(Sha512tDigest t)
|
|
: base(t)
|
|
{
|
|
int num = t.digestLength;
|
|
this.digestLength = num;
|
|
IMemoable memoable = ((IMemoable)this).Copy();
|
|
}
|
|
|
|
// Token: 0x17001D22 RID: 7458
|
|
// (get) Token: 0x0600BBAF RID: 48047 RVA: 0x002A8C50 File Offset: 0x002A6E50
|
|
[Token(Token = "0x17001D22")]
|
|
public override string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600BBAF")]
|
|
[Address(RVA = "0x1FE2700", Offset = "0x1FE1500", VA = "0x181FE2700", Slot = "14")]
|
|
get
|
|
{
|
|
int num = this.digestLength;
|
|
return "SHA-512/" + num;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BBB0 RID: 48048 RVA: 0x002A8C70 File Offset: 0x002A6E70
|
|
[Token(Token = "0x600BBB0")]
|
|
[Address(RVA = "0x404240", Offset = "0x403040", VA = "0x180404240", Slot = "15")]
|
|
public override int GetDigestSize()
|
|
{
|
|
return this.digestLength;
|
|
}
|
|
|
|
// Token: 0x0600BBB1 RID: 48049 RVA: 0x002A8C84 File Offset: 0x002A6E84
|
|
[Token(Token = "0x600BBB1")]
|
|
[Address(RVA = "0x1FE1F20", Offset = "0x1FE0D20", VA = "0x181FE1F20", 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: 0x0600BBB2 RID: 48050 RVA: 0x002A8DE8 File Offset: 0x002A6FE8
|
|
[Token(Token = "0x600BBB2")]
|
|
[Address(RVA = "0x1FE21D0", Offset = "0x1FE0FD0", VA = "0x181FE21D0", 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: 0x0600BBB3 RID: 48051 RVA: 0x002A8E74 File Offset: 0x002A7074
|
|
[Token(Token = "0x600BBB3")]
|
|
[Address(RVA = "0x1FE2760", Offset = "0x1FE1560", VA = "0x181FE2760")]
|
|
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: 0x0600BBB4 RID: 48052 RVA: 0x002A8FB4 File Offset: 0x002A71B4
|
|
[Token(Token = "0x600BBB4")]
|
|
[Address(RVA = "0x1FE2480", Offset = "0x1FE1280", VA = "0x181FE2480")]
|
|
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: 0x0600BBB5 RID: 48053 RVA: 0x002A8FDC File Offset: 0x002A71DC
|
|
[Token(Token = "0x600BBB5")]
|
|
[Address(RVA = "0x1FE23A0", Offset = "0x1FE11A0", VA = "0x181FE23A0")]
|
|
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: 0x0600BBB6 RID: 48054 RVA: 0x002A9004 File Offset: 0x002A7204
|
|
[Token(Token = "0x600BBB6")]
|
|
[Address(RVA = "0x1FE1E60", Offset = "0x1FE0C60", VA = "0x181FE1E60", 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: 0x0600BBB7 RID: 48055 RVA: 0x002A9034 File Offset: 0x002A7234
|
|
[Token(Token = "0x600BBB7")]
|
|
[Address(RVA = "0x1FE2240", Offset = "0x1FE1040", VA = "0x181FE2240", 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: 0x04007738 RID: 30520
|
|
[Token(Token = "0x4007738")]
|
|
private const ulong A5 = 11936128518282651045UL;
|
|
|
|
// Token: 0x04007739 RID: 30521
|
|
[FieldOffset(Offset = "0x88")]
|
|
[Token(Token = "0x4007739")]
|
|
private readonly int digestLength;
|
|
|
|
// Token: 0x0400773A RID: 30522
|
|
[FieldOffset(Offset = "0x90")]
|
|
[Token(Token = "0x400773A")]
|
|
private ulong H1t;
|
|
|
|
// Token: 0x0400773B RID: 30523
|
|
[FieldOffset(Offset = "0x98")]
|
|
[Token(Token = "0x400773B")]
|
|
private ulong H2t;
|
|
|
|
// Token: 0x0400773C RID: 30524
|
|
[FieldOffset(Offset = "0xA0")]
|
|
[Token(Token = "0x400773C")]
|
|
private ulong H3t;
|
|
|
|
// Token: 0x0400773D RID: 30525
|
|
[FieldOffset(Offset = "0xA8")]
|
|
[Token(Token = "0x400773D")]
|
|
private ulong H4t;
|
|
|
|
// Token: 0x0400773E RID: 30526
|
|
[FieldOffset(Offset = "0xB0")]
|
|
[Token(Token = "0x400773E")]
|
|
private ulong H5t;
|
|
|
|
// Token: 0x0400773F RID: 30527
|
|
[FieldOffset(Offset = "0xB8")]
|
|
[Token(Token = "0x400773F")]
|
|
private ulong H6t;
|
|
|
|
// Token: 0x04007740 RID: 30528
|
|
[FieldOffset(Offset = "0xC0")]
|
|
[Token(Token = "0x4007740")]
|
|
private ulong H7t;
|
|
|
|
// Token: 0x04007741 RID: 30529
|
|
[FieldOffset(Offset = "0xC8")]
|
|
[Token(Token = "0x4007741")]
|
|
private ulong H8t;
|
|
}
|
|
}
|