303 lines
9.6 KiB
C#
303 lines
9.6 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001677 RID: 5751
|
|
[Token(Token = "0x2001677")]
|
|
[StructLayout(3)]
|
|
public class SipHash : IMac
|
|
{
|
|
// Token: 0x060099B9 RID: 39353 RVA: 0x00223B14 File Offset: 0x00221D14
|
|
[Token(Token = "0x60099B9")]
|
|
[Address(RVA = "0x2094800", Offset = "0x2093200", VA = "0x182094800")]
|
|
public SipHash()
|
|
{
|
|
this.c = (int)((ulong)2L);
|
|
this.d = (int)((ulong)4L);
|
|
}
|
|
|
|
// Token: 0x060099BA RID: 39354 RVA: 0x00223B3C File Offset: 0x00221D3C
|
|
[Token(Token = "0x60099BA")]
|
|
[Address(RVA = "0x823C30", Offset = "0x822630", VA = "0x180823C30")]
|
|
public SipHash(int c, int d)
|
|
{
|
|
this.c = c;
|
|
this.d = d;
|
|
}
|
|
|
|
// Token: 0x17001894 RID: 6292
|
|
// (get) Token: 0x060099BB RID: 39355 RVA: 0x00223B60 File Offset: 0x00221D60
|
|
[Token(Token = "0x17001894")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x60099BB")]
|
|
[Address(RVA = "0x20F8CF0", Offset = "0x20F76F0", VA = "0x1820F8CF0", Slot = "11")]
|
|
get
|
|
{
|
|
object[] array = new object[4];
|
|
if ("SipHash-" != 0)
|
|
{
|
|
}
|
|
array[0] = "SipHash-";
|
|
int num = this.c;
|
|
if (num != 0)
|
|
{
|
|
}
|
|
array[1] = num;
|
|
if ("-" != 0)
|
|
{
|
|
}
|
|
array[2] = "-";
|
|
int num2 = this.d;
|
|
num = num2;
|
|
if (num2 != 0)
|
|
{
|
|
}
|
|
array[3] = num;
|
|
return string.Concat(array);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060099BC RID: 39356 RVA: 0x00223BD0 File Offset: 0x00221DD0
|
|
[Token(Token = "0x60099BC")]
|
|
[Address(RVA = "0x56E570", Offset = "0x56CF70", VA = "0x18056E570", Slot = "12")]
|
|
public virtual int GetMacSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x060099BD RID: 39357 RVA: 0x00223BE0 File Offset: 0x00221DE0
|
|
[Token(Token = "0x60099BD")]
|
|
[Address(RVA = "0x20F8A90", Offset = "0x20F7490", VA = "0x1820F8A90", Slot = "13")]
|
|
public virtual void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060099BD)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.SipHash::Init(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_50:
|
|
stloc:ArgumentException(var_7_5F, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("must be a 128-bit key"), 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: 0x060099BE RID: 39358 RVA: 0x00223C50 File Offset: 0x00221E50
|
|
[Token(Token = "0x60099BE")]
|
|
[Address(RVA = "0x20F8CA0", Offset = "0x20F76A0", VA = "0x1820F8CA0", Slot = "14")]
|
|
public virtual void Update(byte input)
|
|
{
|
|
int num = this.wordPos;
|
|
num++;
|
|
this.m = (long)input;
|
|
this.wordPos = num;
|
|
if (num == 8)
|
|
{
|
|
this.Reset();
|
|
this.wordPos = (int)((ulong)0L);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060099BF RID: 39359 RVA: 0x00223C8C File Offset: 0x00221E8C
|
|
[Token(Token = "0x60099BF")]
|
|
[Address(RVA = "0x20F8790", Offset = "0x20F7190", VA = "0x1820F8790", Slot = "15")]
|
|
public virtual void BlockUpdate(byte[] input, int offset, int length)
|
|
{
|
|
int num = this.wordPos;
|
|
int num2 = 0;
|
|
if (num != 0)
|
|
{
|
|
if (length > 0)
|
|
{
|
|
ulong num3 = Pack.LE_To_UInt64(input, 0);
|
|
long num4 = this.m;
|
|
this.m = num4;
|
|
this.Reset();
|
|
num2 += 8;
|
|
this.m = (long)num3;
|
|
}
|
|
if (num2 >= length)
|
|
{
|
|
return;
|
|
}
|
|
int num5 = this.wordPos;
|
|
num5++;
|
|
byte b;
|
|
this.m = (long)b;
|
|
this.wordPos = num5;
|
|
if (num5 == 8)
|
|
{
|
|
this.Reset();
|
|
this.wordPos = num2;
|
|
}
|
|
}
|
|
if (length > 0)
|
|
{
|
|
ulong num6 = Pack.LE_To_UInt64(input, 0);
|
|
this.m = (long)num6;
|
|
this.Reset();
|
|
num2 += 8;
|
|
}
|
|
if (num2 < length)
|
|
{
|
|
byte b2;
|
|
this.m = (long)b2;
|
|
}
|
|
this.wordPos = length;
|
|
}
|
|
|
|
// Token: 0x060099C0 RID: 39360 RVA: 0x00223D40 File Offset: 0x00221F40
|
|
[Token(Token = "0x60099C0")]
|
|
[Address(RVA = "0x20F89C0", Offset = "0x20F73C0", VA = "0x1820F89C0", Slot = "16")]
|
|
public virtual long DoFinal()
|
|
{
|
|
int num = this.wordPos;
|
|
uint num2;
|
|
num2 -= (uint)num;
|
|
long num3 = this.m;
|
|
this.m = num3;
|
|
this.Reset();
|
|
this.ProcessMessageWord();
|
|
return this.v3;
|
|
}
|
|
|
|
// Token: 0x060099C1 RID: 39361 RVA: 0x00223D78 File Offset: 0x00221F78
|
|
[Token(Token = "0x60099C1")]
|
|
[Address(RVA = "0x20F8970", Offset = "0x20F7370", VA = "0x1820F8970", Slot = "17")]
|
|
public virtual int DoFinal(byte[] output, int outOff)
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x060099C2 RID: 39362 RVA: 0x00223D88 File Offset: 0x00221F88
|
|
[Token(Token = "0x60099C2")]
|
|
[Address(RVA = "0x20F8C20", Offset = "0x20F7620", VA = "0x1820F8C20", Slot = "18")]
|
|
public virtual void Reset()
|
|
{
|
|
long num = this.k0;
|
|
long num2 = this.k1;
|
|
this.v0 = num;
|
|
num = num2;
|
|
this.v1 = num;
|
|
this.v2 = num;
|
|
int num3 = 0;
|
|
this.v3 = num2;
|
|
this.m = (long)num3;
|
|
this.wordPos = num3;
|
|
}
|
|
|
|
// Token: 0x060099C3 RID: 39363 RVA: 0x00223DD4 File Offset: 0x00221FD4
|
|
[Token(Token = "0x60099C3")]
|
|
[Address(RVA = "0x20F8BE0", Offset = "0x20F75E0", VA = "0x1820F8BE0", Slot = "19")]
|
|
protected virtual void ProcessMessageWord()
|
|
{
|
|
this.ProcessMessageWord();
|
|
long num = this.m;
|
|
}
|
|
|
|
// Token: 0x060099C4 RID: 39364 RVA: 0x00223DF0 File Offset: 0x00221FF0
|
|
[Token(Token = "0x60099C4")]
|
|
[Address(RVA = "0x20F86C0", Offset = "0x20F70C0", VA = "0x1820F86C0", Slot = "20")]
|
|
protected virtual void ApplySipRounds(int n)
|
|
{
|
|
long num = this.v0;
|
|
long num2 = this.v1;
|
|
long num3 = this.v2;
|
|
long num4 = this.v3;
|
|
if (n > 0)
|
|
{
|
|
num += num2;
|
|
num3 += num4;
|
|
num3 += num2;
|
|
num = num3;
|
|
num += num4;
|
|
num = num3;
|
|
num3 = num;
|
|
while (n != 0)
|
|
{
|
|
}
|
|
}
|
|
this.v0 = num;
|
|
this.v1 = num2;
|
|
this.v2 = num3;
|
|
this.v3 = num4;
|
|
}
|
|
|
|
// Token: 0x060099C5 RID: 39365 RVA: 0x00223E54 File Offset: 0x00222054
|
|
[Token(Token = "0x60099C5")]
|
|
[Address(RVA = "0x20F8C80", Offset = "0x20F7680", VA = "0x1820F8C80")]
|
|
protected static long RotateLeft(long x, int n)
|
|
{
|
|
return x;
|
|
}
|
|
|
|
// Token: 0x040064FD RID: 25853
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40064FD")]
|
|
protected readonly int c;
|
|
|
|
// Token: 0x040064FE RID: 25854
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x14")]
|
|
[Token(Token = "0x40064FE")]
|
|
protected readonly int d;
|
|
|
|
// Token: 0x040064FF RID: 25855
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40064FF")]
|
|
protected long k0;
|
|
|
|
// Token: 0x04006500 RID: 25856
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006500")]
|
|
protected long k1;
|
|
|
|
// Token: 0x04006501 RID: 25857
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006501")]
|
|
protected long v0;
|
|
|
|
// Token: 0x04006502 RID: 25858
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006502")]
|
|
protected long v1;
|
|
|
|
// Token: 0x04006503 RID: 25859
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006503")]
|
|
protected long v2;
|
|
|
|
// Token: 0x04006504 RID: 25860
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4006504")]
|
|
protected long v3;
|
|
|
|
// Token: 0x04006505 RID: 25861
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4006505")]
|
|
protected long m;
|
|
|
|
// Token: 0x04006506 RID: 25862
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4006506")]
|
|
protected int wordPos;
|
|
|
|
// Token: 0x04006507 RID: 25863
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x54")]
|
|
[Token(Token = "0x4006507")]
|
|
protected int wordCount;
|
|
}
|
|
}
|