252 lines
6.8 KiB
C#
252 lines
6.8 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x0200165C RID: 5724
|
|
[Token(Token = "0x200165C")]
|
|
[StructLayout(3)]
|
|
public class GOfbBlockCipher : IBlockCipher
|
|
{
|
|
// Token: 0x0600989D RID: 39069 RVA: 0x0021DF64 File Offset: 0x0021C164
|
|
[Token(Token = "0x600989D")]
|
|
[Address(RVA = "0x20EBA60", Offset = "0x20EA460", VA = "0x1820EBA60")]
|
|
public GOfbBlockCipher(IBlockCipher cipher)
|
|
{
|
|
this.cipher = cipher;
|
|
byte[] array = new byte[0];
|
|
this.IV = array;
|
|
byte[] array2 = new byte[array];
|
|
this.ofbV = array2;
|
|
byte[] array3 = new byte[array2];
|
|
this.ofbOutV = array3;
|
|
}
|
|
|
|
// Token: 0x0600989E RID: 39070 RVA: 0x0021DFC0 File Offset: 0x0021C1C0
|
|
[Token(Token = "0x600989E")]
|
|
[Address(RVA = "0x3C1250", Offset = "0x3BFC50", VA = "0x1803C1250")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x0600989F RID: 39071 RVA: 0x0021DFD4 File Offset: 0x0021C1D4
|
|
[Token(Token = "0x600989F")]
|
|
[Address(RVA = "0x20EB4F0", Offset = "0x20E9EF0", VA = "0x1820EB4F0", Slot = "5")]
|
|
public void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
do
|
|
{
|
|
int num = 0;
|
|
this.firstStep = true;
|
|
this.N3 = num;
|
|
if (parameters == 0 || parameters == 0)
|
|
{
|
|
goto IL_4D;
|
|
}
|
|
}
|
|
while (parameters == 0);
|
|
byte[] iv = this.IV;
|
|
byte[] array;
|
|
int length = array.Length;
|
|
int length2 = iv.Length;
|
|
int num2 = 0;
|
|
int num3 = 0;
|
|
Array.Copy(array, num2, iv, num3, length2);
|
|
IL_4D:
|
|
byte[] iv2 = this.IV;
|
|
int length3 = iv2.Length;
|
|
int num4 = 0;
|
|
byte[] array2 = this.ofbV;
|
|
int num5 = 0;
|
|
Array.Copy(iv2, num5, array2, num4, length3);
|
|
IBlockCipher blockCipher = this.cipher;
|
|
if (parameters != 0)
|
|
{
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700187B RID: 6267
|
|
// (get) Token: 0x060098A0 RID: 39072 RVA: 0x0021E078 File Offset: 0x0021C278
|
|
[Token(Token = "0x1700187B")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x60098A0")]
|
|
[Address(RVA = "0x20EBC40", Offset = "0x20EA640", VA = "0x1820EBC40", Slot = "4")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/GCTR";
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700187C RID: 6268
|
|
// (get) Token: 0x060098A1 RID: 39073 RVA: 0x0021E0A0 File Offset: 0x0021C2A0
|
|
[Token(Token = "0x1700187C")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x60098A1")]
|
|
[Address(RVA = "0x4405A0", Offset = "0x43EFA0", VA = "0x1804405A0", Slot = "7")]
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060098A2 RID: 39074 RVA: 0x0021E0B0 File Offset: 0x0021C2B0
|
|
[Token(Token = "0x60098A2")]
|
|
[Address(RVA = "0x4D24F0", Offset = "0x4D0EF0", VA = "0x1804D24F0", Slot = "6")]
|
|
public int GetBlockSize()
|
|
{
|
|
return this.blockSize;
|
|
}
|
|
|
|
// Token: 0x060098A3 RID: 39075 RVA: 0x0021E0C4 File Offset: 0x0021C2C4
|
|
[Token(Token = "0x60098A3")]
|
|
[Address(RVA = "0x20EB720", Offset = "0x20EA120", VA = "0x1820EB720", Slot = "8")]
|
|
public int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
int num = 0;
|
|
if ((this.firstStep ? 1 : 0) != num)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
this.firstStep = num != 0;
|
|
byte[] array = this.ofbOutV;
|
|
byte[] array2 = this.ofbOutV;
|
|
int num2 = 0;
|
|
int num3 = this.bytesToint(array2, num2);
|
|
byte[] array3 = this.ofbOutV;
|
|
this.N3 = num3;
|
|
int num4 = this.bytesToint(array3, 4);
|
|
this.N4 = num4;
|
|
}
|
|
int num5 = this.N3;
|
|
num5 += 16843009;
|
|
int num6 = this.N4;
|
|
this.N3 = num5;
|
|
if (num6 < 16843012 && num6 > 0)
|
|
{
|
|
num6++;
|
|
this.N4 = num6;
|
|
}
|
|
byte[] array4 = this.ofbV;
|
|
int num7 = 0;
|
|
this.intTobytes(num5, array4, num7);
|
|
byte[] array5 = this.ofbV;
|
|
int n = this.N4;
|
|
uint num8;
|
|
this.intTobytes(n, array5, (int)num8);
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
byte[] array6 = this.ofbOutV;
|
|
int num9;
|
|
if (this.blockSize > 0)
|
|
{
|
|
byte[] array7 = this.ofbOutV;
|
|
num9 = this.blockSize;
|
|
}
|
|
byte[] array8 = this.ofbV;
|
|
int num10 = array8.Length;
|
|
int num11 = 0;
|
|
num10 -= num9;
|
|
Array.Copy(array8, num9, array8, num11, num10);
|
|
byte[] array9 = this.ofbV;
|
|
int num12 = this.blockSize;
|
|
int num13 = 0;
|
|
int num14 = array9.Length;
|
|
byte[] array10 = this.ofbOutV;
|
|
num14 -= num12;
|
|
Array.Copy(array10, num13, array9, num14, num12);
|
|
return this.blockSize;
|
|
}
|
|
|
|
// Token: 0x060098A4 RID: 39076 RVA: 0x0021E234 File Offset: 0x0021C434
|
|
[Token(Token = "0x60098A4")]
|
|
[Address(RVA = "0x20EB9F0", Offset = "0x20EA3F0", VA = "0x1820EB9F0", Slot = "9")]
|
|
public void Reset()
|
|
{
|
|
byte[] iv = this.IV;
|
|
int length = iv.Length;
|
|
int num = 0;
|
|
byte[] array = this.ofbV;
|
|
int num2 = 0;
|
|
Array.Copy(iv, num2, array, num, length);
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060098A5 RID: 39077 RVA: 0x0021E274 File Offset: 0x0021C474
|
|
[Token(Token = "0x60098A5")]
|
|
[Address(RVA = "0x20EBB80", Offset = "0x20EA580", VA = "0x1820EBB80")]
|
|
private int bytesToint(byte[] inBytes, int inOff)
|
|
{
|
|
int length = inBytes.Length;
|
|
int num = inOff + 1;
|
|
byte b;
|
|
byte b2;
|
|
b += b2;
|
|
b += b2;
|
|
byte b3;
|
|
b += b3;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060098A6 RID: 39078 RVA: 0x0021E2A0 File Offset: 0x0021C4A0
|
|
[Token(Token = "0x60098A6")]
|
|
[Address(RVA = "0x20EBCA0", Offset = "0x20EA6A0", VA = "0x1820EBCA0")]
|
|
private void intTobytes(int num, byte[] outBytes, int outOff)
|
|
{
|
|
int num2 = outOff + 1;
|
|
}
|
|
|
|
// Token: 0x0400644C RID: 25676
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400644C")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x0400644D RID: 25677
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400644D")]
|
|
private byte[] ofbV;
|
|
|
|
// Token: 0x0400644E RID: 25678
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400644E")]
|
|
private byte[] ofbOutV;
|
|
|
|
// Token: 0x0400644F RID: 25679
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400644F")]
|
|
private readonly int blockSize;
|
|
|
|
// Token: 0x04006450 RID: 25680
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006450")]
|
|
private readonly IBlockCipher cipher;
|
|
|
|
// Token: 0x04006451 RID: 25681
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006451")]
|
|
private bool firstStep = true;
|
|
|
|
// Token: 0x04006452 RID: 25682
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x3C")]
|
|
[Token(Token = "0x4006452")]
|
|
private int N3;
|
|
|
|
// Token: 0x04006453 RID: 25683
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4006453")]
|
|
private int N4;
|
|
|
|
// Token: 0x04006454 RID: 25684
|
|
[Token(Token = "0x4006454")]
|
|
private const int C1 = 16843012;
|
|
|
|
// Token: 0x04006455 RID: 25685
|
|
[Token(Token = "0x4006455")]
|
|
private const int C2 = 16843009;
|
|
}
|
|
}
|