250 lines
6.6 KiB
C#
250 lines
6.6 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x02001C39 RID: 7225
|
|
[Token(Token = "0x2001C39")]
|
|
public class GOfbBlockCipher : IBlockCipher
|
|
{
|
|
// Token: 0x0600B477 RID: 46199 RVA: 0x0027557C File Offset: 0x0027377C
|
|
[Token(Token = "0x600B477")]
|
|
[Address(RVA = "0x1C22AC0", Offset = "0x1C218C0", VA = "0x181C22AC0")]
|
|
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: 0x0600B478 RID: 46200 RVA: 0x002755D8 File Offset: 0x002737D8
|
|
[Token(Token = "0x600B478")]
|
|
[Address(RVA = "0x3FA180", Offset = "0x3F8F80", VA = "0x1803FA180")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x0600B479 RID: 46201 RVA: 0x002755EC File Offset: 0x002737EC
|
|
[Token(Token = "0x600B479")]
|
|
[Address(RVA = "0x1C22550", Offset = "0x1C21350", VA = "0x181C22550", 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: 0x17001C7C RID: 7292
|
|
// (get) Token: 0x0600B47A RID: 46202 RVA: 0x00275690 File Offset: 0x00273890
|
|
[Token(Token = "0x17001C7C")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B47A")]
|
|
[Address(RVA = "0x1C22CA0", Offset = "0x1C21AA0", VA = "0x181C22CA0", Slot = "4")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/GCTR";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C7D RID: 7293
|
|
// (get) Token: 0x0600B47B RID: 46203 RVA: 0x002756B8 File Offset: 0x002738B8
|
|
[Token(Token = "0x17001C7D")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B47B")]
|
|
[Address(RVA = "0x460D40", Offset = "0x45FB40", VA = "0x180460D40", Slot = "7")]
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B47C RID: 46204 RVA: 0x002756C8 File Offset: 0x002738C8
|
|
[Token(Token = "0x600B47C")]
|
|
[Address(RVA = "0x42EE50", Offset = "0x42DC50", VA = "0x18042EE50", Slot = "6")]
|
|
public int GetBlockSize()
|
|
{
|
|
return this.blockSize;
|
|
}
|
|
|
|
// Token: 0x0600B47D RID: 46205 RVA: 0x002756DC File Offset: 0x002738DC
|
|
[Token(Token = "0x600B47D")]
|
|
[Address(RVA = "0x1C22780", Offset = "0x1C21580", VA = "0x181C22780", 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: 0x0600B47E RID: 46206 RVA: 0x0027584C File Offset: 0x00273A4C
|
|
[Token(Token = "0x600B47E")]
|
|
[Address(RVA = "0x1C22A50", Offset = "0x1C21850", VA = "0x181C22A50", 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: 0x0600B47F RID: 46207 RVA: 0x0027588C File Offset: 0x00273A8C
|
|
[Token(Token = "0x600B47F")]
|
|
[Address(RVA = "0x1C22BE0", Offset = "0x1C219E0", VA = "0x181C22BE0")]
|
|
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: 0x0600B480 RID: 46208 RVA: 0x002758B8 File Offset: 0x00273AB8
|
|
[Token(Token = "0x600B480")]
|
|
[Address(RVA = "0x1C22D00", Offset = "0x1C21B00", VA = "0x181C22D00")]
|
|
private void intTobytes(int num, byte[] outBytes, int outOff)
|
|
{
|
|
int num2 = outOff + 1;
|
|
}
|
|
|
|
// Token: 0x0400728F RID: 29327
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400728F")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x04007290 RID: 29328
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007290")]
|
|
private byte[] ofbV;
|
|
|
|
// Token: 0x04007291 RID: 29329
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007291")]
|
|
private byte[] ofbOutV;
|
|
|
|
// Token: 0x04007292 RID: 29330
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007292")]
|
|
private readonly int blockSize;
|
|
|
|
// Token: 0x04007293 RID: 29331
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007293")]
|
|
private readonly IBlockCipher cipher;
|
|
|
|
// Token: 0x04007294 RID: 29332
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007294")]
|
|
private bool firstStep = true;
|
|
|
|
// Token: 0x04007295 RID: 29333
|
|
[FieldOffset(Offset = "0x3C")]
|
|
[Token(Token = "0x4007295")]
|
|
private int N3;
|
|
|
|
// Token: 0x04007296 RID: 29334
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007296")]
|
|
private int N4;
|
|
|
|
// Token: 0x04007297 RID: 29335
|
|
[Token(Token = "0x4007297")]
|
|
private const int C1 = 16843012;
|
|
|
|
// Token: 0x04007298 RID: 29336
|
|
[Token(Token = "0x4007298")]
|
|
private const int C2 = 16843009;
|
|
}
|
|
}
|