(NephriteCrypt): another KiriKiri encryption scheme.

This commit is contained in:
morkt 2018-04-10 22:18:11 +04:00
parent 97aac515f6
commit 83fa48b71d

View File

@ -578,6 +578,34 @@ namespace GameRes.Formats.KiriKiri
}
}
[Serializable]
public class NephriteCrypt : ICrypt
{
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
if (0 != (offset & 1))
return (byte)(value ^ offset);
else
return (byte)(value ^ entry.Hash);
}
public override void Decrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
{
for (int i = 0; i < count; ++i, ++offset)
{
if (0 != (offset & 1))
values[pos+i] ^= (byte)offset;
else
values[pos+i] ^= (byte)entry.Hash;
}
}
public override void Encrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
{
Decrypt (entry, offset, values, pos, count);
}
}
[Serializable]
public class GakuenButouCrypt : ICrypt
{