scripts
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ExitGames.Client.Photon.EncryptorManaged
|
||||
{
|
||||
// Token: 0x0200003C RID: 60
|
||||
public class Decryptor : CryptoBase
|
||||
{
|
||||
// Token: 0x060002C3 RID: 707 RVA: 0x00013F10 File Offset: 0x00012110
|
||||
public byte[] DecryptBufferWithIV(byte[] data, int offset, int len, out int outLen)
|
||||
{
|
||||
Buffer.BlockCopy(data, offset, this.IV, 0, 16);
|
||||
this.encryptor.IV = this.IV;
|
||||
byte[] array;
|
||||
using (ICryptoTransform cryptoTransform = this.encryptor.CreateDecryptor())
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(data, offset + 16, len - 16))
|
||||
{
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Read))
|
||||
{
|
||||
using (MemoryStream memoryStream2 = new MemoryStream(len - 16))
|
||||
{
|
||||
int num;
|
||||
do
|
||||
{
|
||||
num = cryptoStream.Read(this.readBuffer, 0, 16);
|
||||
bool flag = num != 0;
|
||||
if (flag)
|
||||
{
|
||||
memoryStream2.Write(this.readBuffer, 0, num);
|
||||
}
|
||||
}
|
||||
while (num != 0);
|
||||
outLen = (int)memoryStream2.Length;
|
||||
array = memoryStream2.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060002C4 RID: 708 RVA: 0x00014024 File Offset: 0x00012224
|
||||
public bool CheckHMAC(byte[] data, int len)
|
||||
{
|
||||
this.hmacsha256.ComputeHash(data, 0, len - 32);
|
||||
byte[] hash = this.hmacsha256.Hash;
|
||||
bool flag = true;
|
||||
int num = 0;
|
||||
while (num < 4 && flag)
|
||||
{
|
||||
int num2 = len - 32 + num * 8;
|
||||
int num3 = num * 8;
|
||||
flag = data[num2] == hash[num3] && data[num2 + 1] == hash[num3 + 1] && data[num2 + 2] == hash[num3 + 2] && data[num2 + 3] == hash[num3 + 3] && data[num2 + 4] == hash[num3 + 4] && data[num2 + 5] == hash[num3 + 5] && data[num2 + 6] == hash[num3 + 6] && data[num2 + 7] == hash[num3 + 7];
|
||||
num++;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x04000184 RID: 388
|
||||
private readonly byte[] IV = new byte[16];
|
||||
|
||||
// Token: 0x04000185 RID: 389
|
||||
private readonly byte[] readBuffer = new byte[16];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user