301 lines
9.3 KiB
C#
301 lines
9.3 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001C54 RID: 7252
|
|
[Token(Token = "0x2001C54")]
|
|
public class SipHash : IMac
|
|
{
|
|
// Token: 0x0600B593 RID: 46483 RVA: 0x0027B12C File Offset: 0x0027932C
|
|
[Token(Token = "0x600B593")]
|
|
[Address(RVA = "0x1C30570", Offset = "0x1C2F370", VA = "0x181C30570")]
|
|
public SipHash()
|
|
{
|
|
this.c = (int)((ulong)2L);
|
|
this.d = (int)((ulong)4L);
|
|
}
|
|
|
|
// Token: 0x0600B594 RID: 46484 RVA: 0x0027B154 File Offset: 0x00279354
|
|
[Token(Token = "0x600B594")]
|
|
[Address(RVA = "0x8F0C90", Offset = "0x8EFA90", VA = "0x1808F0C90")]
|
|
public SipHash(int c, int d)
|
|
{
|
|
this.c = c;
|
|
this.d = d;
|
|
}
|
|
|
|
// Token: 0x17001C95 RID: 7317
|
|
// (get) Token: 0x0600B595 RID: 46485 RVA: 0x0027B178 File Offset: 0x00279378
|
|
[Token(Token = "0x17001C95")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B595")]
|
|
[Address(RVA = "0x1C305A0", Offset = "0x1C2F3A0", VA = "0x181C305A0", 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: 0x0600B596 RID: 46486 RVA: 0x0027B1E8 File Offset: 0x002793E8
|
|
[Token(Token = "0x600B596")]
|
|
[Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "12")]
|
|
public virtual int GetMacSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600B597 RID: 46487 RVA: 0x0027B1F8 File Offset: 0x002793F8
|
|
[Token(Token = "0x600B597")]
|
|
[Address(RVA = "0x1C30310", Offset = "0x1C2F110", VA = "0x181C30310", Slot = "13")]
|
|
public virtual void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B597)
|
|
|
|
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: 0x0600B598 RID: 46488 RVA: 0x0027B268 File Offset: 0x00279468
|
|
[Token(Token = "0x600B598")]
|
|
[Address(RVA = "0x1C30520", Offset = "0x1C2F320", VA = "0x181C30520", 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: 0x0600B599 RID: 46489 RVA: 0x0027B2A4 File Offset: 0x002794A4
|
|
[Token(Token = "0x600B599")]
|
|
[Address(RVA = "0x1C30010", Offset = "0x1C2EE10", VA = "0x181C30010", 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: 0x0600B59A RID: 46490 RVA: 0x0027B358 File Offset: 0x00279558
|
|
[Token(Token = "0x600B59A")]
|
|
[Address(RVA = "0x1C30240", Offset = "0x1C2F040", VA = "0x181C30240", 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: 0x0600B59B RID: 46491 RVA: 0x0027B390 File Offset: 0x00279590
|
|
[Token(Token = "0x600B59B")]
|
|
[Address(RVA = "0x1C301F0", Offset = "0x1C2EFF0", VA = "0x181C301F0", Slot = "17")]
|
|
public virtual int DoFinal(byte[] output, int outOff)
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600B59C RID: 46492 RVA: 0x0027B3A0 File Offset: 0x002795A0
|
|
[Token(Token = "0x600B59C")]
|
|
[Address(RVA = "0x1C304A0", Offset = "0x1C2F2A0", VA = "0x181C304A0", 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: 0x0600B59D RID: 46493 RVA: 0x0027B3EC File Offset: 0x002795EC
|
|
[Token(Token = "0x600B59D")]
|
|
[Address(RVA = "0x1C30460", Offset = "0x1C2F260", VA = "0x181C30460", Slot = "19")]
|
|
protected virtual void ProcessMessageWord()
|
|
{
|
|
this.ProcessMessageWord();
|
|
long num = this.m;
|
|
}
|
|
|
|
// Token: 0x0600B59E RID: 46494 RVA: 0x0027B408 File Offset: 0x00279608
|
|
[Token(Token = "0x600B59E")]
|
|
[Address(RVA = "0x1C2FF40", Offset = "0x1C2ED40", VA = "0x181C2FF40", 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: 0x0600B59F RID: 46495 RVA: 0x0027B46C File Offset: 0x0027966C
|
|
[Token(Token = "0x600B59F")]
|
|
[Address(RVA = "0x1C30500", Offset = "0x1C2F300", VA = "0x181C30500")]
|
|
protected static long RotateLeft(long x, int n)
|
|
{
|
|
return x;
|
|
}
|
|
|
|
// Token: 0x04007340 RID: 29504
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007340")]
|
|
protected readonly int c;
|
|
|
|
// Token: 0x04007341 RID: 29505
|
|
[FieldOffset(Offset = "0x14")]
|
|
[Token(Token = "0x4007341")]
|
|
protected readonly int d;
|
|
|
|
// Token: 0x04007342 RID: 29506
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007342")]
|
|
protected long k0;
|
|
|
|
// Token: 0x04007343 RID: 29507
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007343")]
|
|
protected long k1;
|
|
|
|
// Token: 0x04007344 RID: 29508
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007344")]
|
|
protected long v0;
|
|
|
|
// Token: 0x04007345 RID: 29509
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007345")]
|
|
protected long v1;
|
|
|
|
// Token: 0x04007346 RID: 29510
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007346")]
|
|
protected long v2;
|
|
|
|
// Token: 0x04007347 RID: 29511
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007347")]
|
|
protected long v3;
|
|
|
|
// Token: 0x04007348 RID: 29512
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4007348")]
|
|
protected long m;
|
|
|
|
// Token: 0x04007349 RID: 29513
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4007349")]
|
|
protected int wordPos;
|
|
|
|
// Token: 0x0400734A RID: 29514
|
|
[FieldOffset(Offset = "0x54")]
|
|
[Token(Token = "0x400734A")]
|
|
protected int wordCount;
|
|
}
|
|
}
|