mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-30 17:05:37 +08:00
511 lines
32 KiB
C#
511 lines
32 KiB
C#
|
//! \file Encryption.cs
|
||
|
//! \date Sat Oct 01 22:25:09 2016
|
||
|
//! \brief Encryption used in Primel the Adventure System.
|
||
|
//
|
||
|
// Copyright (C) 2016 by morkt
|
||
|
//
|
||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
// of this software and associated documentation files (the "Software"), to
|
||
|
// deal in the Software without restriction, including without limitation the
|
||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||
|
// furnished to do so, subject to the following conditions:
|
||
|
//
|
||
|
// The above copyright notice and this permission notice shall be included in
|
||
|
// all copies or substantial portions of the Software.
|
||
|
//
|
||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
|
// IN THE SOFTWARE.
|
||
|
//
|
||
|
|
||
|
using System;
|
||
|
using System.Security.Cryptography;
|
||
|
using System.Linq;
|
||
|
using GameRes.Utility;
|
||
|
|
||
|
namespace GameRes.Formats.Primel
|
||
|
{
|
||
|
internal abstract class PrimelEncyptionBase : ICryptoTransform
|
||
|
{
|
||
|
internal const int BlockSize = 16;
|
||
|
|
||
|
public bool CanTransformMultipleBlocks { get { return true; } }
|
||
|
public bool CanReuseTransform { get { return false; } }
|
||
|
public int InputBlockSize { get { return BlockSize; } }
|
||
|
public int OutputBlockSize { get { return BlockSize; } }
|
||
|
|
||
|
#region Static tables
|
||
|
internal static readonly uint[] DefaultKey = {
|
||
|
0x243F6A89, 0xB7E15163, 0x9E3779B9, 0x6F2DEC55,
|
||
|
0x6A09E668, 0xBB67AE86, 0xB504F334, 0x93CD3A2D,
|
||
|
};
|
||
|
|
||
|
internal static readonly byte[,] CodeTable = new byte[4,256] {
|
||
|
{
|
||
|
0x29, 0x4e, 0xf8, 0x6c, 0x4d, 0xd1, 0x52, 0x5b, 0x2f, 0x4b, 0xe5, 0x0a, 0xa4, 0xbb, 0xf7, 0xdf,
|
||
|
0x9f, 0x8c, 0x27, 0xb9, 0x25, 0xfd, 0x07, 0x4a, 0x7c, 0x81, 0x10, 0x26, 0x46, 0x11, 0xa3, 0xdb,
|
||
|
0x39, 0x08, 0x55, 0x36, 0x96, 0xc4, 0x5c, 0xfe, 0x2e, 0x66, 0xa6, 0x74, 0x45, 0x60, 0xf3, 0x83,
|
||
|
0x72, 0x3f, 0xc5, 0x99, 0x0d, 0x16, 0x3d, 0x6d, 0x5d, 0x57, 0xae, 0x35, 0xde, 0x8e, 0xa0, 0x41,
|
||
|
0x8b, 0x34, 0xd7, 0xe3, 0xbe, 0x33, 0xb0, 0x44, 0xeb, 0xec, 0xff, 0x91, 0x6e, 0x85, 0x9d, 0x12,
|
||
|
0xaf, 0x8d, 0xe9, 0xba, 0x1c, 0x05, 0xee, 0x3a, 0x03, 0xfa, 0x7b, 0x23, 0xd4, 0x8a, 0xd9, 0x67,
|
||
|
0xca, 0x97, 0x02, 0x70, 0xd8, 0xfc, 0xe4, 0x78, 0x73, 0x19, 0x5e, 0x77, 0x59, 0x69, 0xe0, 0xd6,
|
||
|
0x14, 0x37, 0x00, 0x6b, 0x13, 0x17, 0x0f, 0x49, 0xaa, 0x22, 0x89, 0xe1, 0x7a, 0xad, 0x6a, 0x30,
|
||
|
0x2b, 0xb4, 0xfb, 0xb6,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0x68, 0x4f, 0xfc, 0x37,
|
||
|
0x80, 0x4a, 0xcf, 0x01, 0x9a, 0xc0, 0x1d, 0x3c, 0x8c, 0x4c, 0x3e, 0x0b, 0xc7, 0xa6, 0xae, 0x0f,
|
||
|
0x2c, 0x62, 0xf4, 0x94, 0xce, 0x89, 0x40, 0x22, 0xfd, 0x18, 0x32, 0xc2, 0x9e, 0x64, 0x44, 0xe7,
|
||
|
}
|
||
|
};
|
||
|
#endregion
|
||
|
|
||
|
public abstract int TransformBlock (byte[] inBuffer, int offset, int count, byte[] outBuffer, int outOffset);
|
||
|
|
||
|
public byte[] TransformFinalBlock (byte[] inBuffer, int offset, int count)
|
||
|
{
|
||
|
if (count < BlockSize)
|
||
|
return new ArraySegment<byte> (inBuffer, offset, count).ToArray();
|
||
|
var output = new byte[count];
|
||
|
int tail = count / BlockSize * BlockSize;
|
||
|
count -= TransformBlock (inBuffer, offset, count, output, 0);
|
||
|
if (count > 0)
|
||
|
Buffer.BlockCopy (inBuffer, offset+tail, output, tail, count);
|
||
|
return output;
|
||
|
}
|
||
|
|
||
|
static protected uint MutateKey (uint k)
|
||
|
{
|
||
|
return (uint)CodeTable[0, k & 0xFF]
|
||
|
| (uint)CodeTable[1, (k >> 8) & 0xFF] << 8
|
||
|
| (uint)CodeTable[2, (k >> 16) & 0xFF] << 16
|
||
|
| (uint)CodeTable[3, k >> 24] << 24;
|
||
|
}
|
||
|
|
||
|
#region IDisposable implementation
|
||
|
bool _disposed = false;
|
||
|
public void Dispose ()
|
||
|
{
|
||
|
Dispose (true);
|
||
|
GC.SuppressFinalize (this);
|
||
|
}
|
||
|
|
||
|
protected virtual void Dispose (bool disposing)
|
||
|
{
|
||
|
if (!_disposed)
|
||
|
{
|
||
|
_disposed = true;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
|
||
|
internal class Primel1Encyption : PrimelEncyptionBase
|
||
|
{
|
||
|
uint[] m_key = new uint[4];
|
||
|
byte[] m_iv;
|
||
|
|
||
|
public Primel1Encyption (byte[] key, byte[] iv)
|
||
|
{
|
||
|
m_iv = iv.Clone() as byte[];
|
||
|
Buffer.BlockCopy (key, 0, m_key, 0, 0x10);
|
||
|
uint k = 0;
|
||
|
for (int i = 0; i < 0x10; ++i)
|
||
|
{
|
||
|
k = m_key[i & 3] ^ (k + DefaultKey[i & 7]);
|
||
|
m_key[i & 3] = MutateKey (k);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override int TransformBlock (byte[] inBuffer, int offset, int count, byte[] outBuffer, int outOffset)
|
||
|
{
|
||
|
int out_count = count / BlockSize;
|
||
|
for (int i = 0; i < out_count; ++i)
|
||
|
{
|
||
|
Transform (inBuffer, offset, outBuffer, outOffset);
|
||
|
for (int j = 0; j < BlockSize; ++j)
|
||
|
{
|
||
|
outBuffer[outOffset++] ^= m_iv[j];
|
||
|
}
|
||
|
Buffer.BlockCopy (inBuffer, offset, m_iv, 0, BlockSize);
|
||
|
offset += BlockSize;
|
||
|
}
|
||
|
return out_count * BlockSize;
|
||
|
}
|
||
|
|
||
|
private void Transform (byte[] input, int src, byte[] output, int dst)
|
||
|
{
|
||
|
for (int k = 0; k < BlockSize / 4; ++k)
|
||
|
{
|
||
|
uint v = LittleEndian.ToUInt32 (input, src);
|
||
|
v ^= m_key[(k - 1) & 3];
|
||
|
v -= m_key[(k - 2) & 3];
|
||
|
v ^= m_key[(k - 3) & 3];
|
||
|
v -= m_key[(k - 4) & 3];
|
||
|
LittleEndian.Pack (v, output, dst);
|
||
|
src += 4;
|
||
|
dst += 4;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
internal class Primel2Encyption : PrimelEncyptionBase
|
||
|
{
|
||
|
int[] m_shifts = new int[8];
|
||
|
uint[] m_key = new uint[4];
|
||
|
byte[] m_iv;
|
||
|
|
||
|
public Primel2Encyption (byte[] key, byte[] iv)
|
||
|
{
|
||
|
m_iv = iv.Clone() as byte[];
|
||
|
Buffer.BlockCopy (key, 0, m_key, 0, 0x10);
|
||
|
uint k = 0;
|
||
|
for (int i = 0; i < 0x10; ++i)
|
||
|
{
|
||
|
k = m_key[i & 3] ^ (k + DefaultKey[(i + 3) & 7]);
|
||
|
m_key[i & 3] = MutateKey (k);
|
||
|
}
|
||
|
for (int i = 0; i < 4; ++i)
|
||
|
{
|
||
|
uint x = m_key[i];
|
||
|
x = (x & 0x55555555) + ((x >> 1) & 0x55555555);
|
||
|
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||
|
x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F);
|
||
|
x = (x & 0x00FF00FF) + ((x >> 8) & 0x00FF00FF);
|
||
|
int s = (int)(x + (x >> 16));
|
||
|
m_shifts[i + 4] = (s ^ ((s + i) >> 1)) & 0xF;
|
||
|
m_shifts[i] = (s + i) & 0x1F;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override int TransformBlock (byte[] inBuffer, int offset, int count, byte[] outBuffer, int outOffset)
|
||
|
{
|
||
|
int out_count = count / BlockSize;
|
||
|
for (int i = 0; i < out_count; ++i)
|
||
|
{
|
||
|
Transform (inBuffer, offset, outBuffer, outOffset);
|
||
|
for (int j = 0; j < BlockSize; ++j)
|
||
|
{
|
||
|
outBuffer[outOffset++] ^= m_iv[j];
|
||
|
}
|
||
|
Buffer.BlockCopy (inBuffer, offset, m_iv, 0, BlockSize);
|
||
|
offset += BlockSize;
|
||
|
}
|
||
|
return out_count * BlockSize;
|
||
|
}
|
||
|
|
||
|
private void Transform (byte[] input, int src, byte[] output, int dst)
|
||
|
{
|
||
|
for (int k = 0; k < BlockSize / 4; ++k)
|
||
|
{
|
||
|
int i = (k - 1) & 3;
|
||
|
int j = (k - 2) & 3;
|
||
|
int m = (k - 3) & 3;
|
||
|
int n = (k - 4) & 3;
|
||
|
uint v = LittleEndian.ToUInt32 (input, src);
|
||
|
v = Binary.RotR (v, m_shifts[i]) + m_key[i];
|
||
|
v = Binary.RotR (v ^ m_key[j], m_shifts[j]);
|
||
|
v = Binary.RotR (v, m_shifts[m]) - m_key[m];
|
||
|
v = Binary.RotR (v ^ m_key[n], m_shifts[n]);
|
||
|
LittleEndian.Pack (v, output, dst);
|
||
|
src += 4;
|
||
|
dst += 4;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
internal class Primel3Encyption : PrimelEncyptionBase
|
||
|
{
|
||
|
int[] m_shifts = new int[8];
|
||
|
int[] m_offsets = new int[4];
|
||
|
uint[] m_key = new uint[8];
|
||
|
byte[] m_iv;
|
||
|
|
||
|
public Primel3Encyption (byte[] key, byte[] iv)
|
||
|
{
|
||
|
m_iv = iv.Clone() as byte[];
|
||
|
Buffer.BlockCopy (key, 0, m_key, 0, 0x10);
|
||
|
uint k = 0;
|
||
|
for (int i = 0; i < 0x20; ++i)
|
||
|
{
|
||
|
k = m_key[i & 7] ^ (k + DefaultKey[(i - 3) & 7]);
|
||
|
m_key[i & 7] = MutateKey (k);
|
||
|
m_offsets[i & 3] = (int)(k >> 7) & 0xF;
|
||
|
}
|
||
|
for (int i = 0; i < 8; ++i)
|
||
|
{
|
||
|
uint x = m_key[i];
|
||
|
x = (x & 0x55555555) + ((x >> 1) & 0x55555555);
|
||
|
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||
|
x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F);
|
||
|
x = (x & 0x00FF00FF) + ((x >> 8) & 0x00FF00FF);
|
||
|
int s = (int)(x + (x >> 16));
|
||
|
m_shifts[i] = (s + i) & 0x1F;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override int TransformBlock (byte[] inBuffer, int offset, int count, byte[] outBuffer, int outOffset)
|
||
|
{
|
||
|
int out_count = count / BlockSize;
|
||
|
for (int i = 0; i < out_count; ++i)
|
||
|
{
|
||
|
Buffer.BlockCopy (inBuffer, offset, outBuffer, outOffset, BlockSize);
|
||
|
for (int j = 7; j >= 0; --j)
|
||
|
{
|
||
|
Transform (outBuffer, outOffset, j);
|
||
|
}
|
||
|
for (int j = 0; j < BlockSize; ++j)
|
||
|
{
|
||
|
outBuffer[outOffset++] ^= m_iv[j];
|
||
|
}
|
||
|
Buffer.BlockCopy (inBuffer, offset, m_iv, 0, BlockSize);
|
||
|
offset += BlockSize;
|
||
|
}
|
||
|
return out_count * BlockSize;
|
||
|
}
|
||
|
|
||
|
private void Transform (byte[] buf, int src, int i)
|
||
|
{
|
||
|
i &= 3;
|
||
|
for (int k = BlockSize / 4 - 2; k >= 0; --k)
|
||
|
{
|
||
|
int pos = src + k * 4 + 2;
|
||
|
uint v = LittleEndian.ToUInt32 (buf, pos);
|
||
|
v = Binary.RotL (v + m_key[i + 4], m_shifts[i + 4]);
|
||
|
LittleEndian.Pack (v ^ m_key[i], buf, pos);
|
||
|
}
|
||
|
int s = 8 * m_offsets[i] + 4;
|
||
|
for (int k = BlockSize / 4 - 1; k >= 0; --k)
|
||
|
{
|
||
|
int pos = src + k * 4;
|
||
|
uint v = LittleEndian.ToUInt32 (buf, pos);
|
||
|
v = Binary.RotR (m_key[i + 4] ^ v, m_shifts[i]);
|
||
|
uint u = ByteMap[Offsets[s], v & 0xFF];
|
||
|
u |= (uint)ByteMap[Offsets[s+1], (v >> 8) & 0xFF] << 8;
|
||
|
u |= (uint)ByteMap[Offsets[s+2], (v >> 16) & 0xFF] << 16;
|
||
|
u |= (uint)ByteMap[Offsets[s+3], v >> 24] << 24;
|
||
|
u -= m_key[i];
|
||
|
LittleEndian.Pack (u, buf, pos);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
readonly static byte[] Offsets = {
|
||
|
3, 0, 6, 5, 2, 1, 7, 4, 2, 4, 0, 6, 3, 5, 1, 7,
|
||
|
3, 1, 7, 5, 2, 0, 6, 4, 0, 3, 6, 5, 1, 2, 7, 4,
|
||
|
3, 1, 4, 7, 2, 0, 5, 6, 6, 3, 4, 0, 7, 2, 5, 1,
|
||
|
4, 6, 2, 1, 5, 7, 3, 0, 6, 5, 2, 1, 7, 4, 3, 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