(KiriKiri.ExaCrypt): another encryption scheme.

This commit is contained in:
morkt 2016-09-11 14:38:22 +04:00
parent 9fe37e18ca
commit e0a75a6ab8

View File

@ -799,4 +799,27 @@ namespace GameRes.Formats.KiriKiri
}
}
}
[Serializable]
public class ExaCrypt : ICrypt
{
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
return (byte)(value ^ (entry.Hash >> (int)((uint)offset % 5)));
}
public override void Decrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
{
int shift = (int)(offset % 5);
for (int i = 0; i < count; ++i)
{
values[pos+i] ^= (byte)(entry.Hash >> ((shift+i) % 5));
}
}
public override void Encrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
{
Decrypt (entry, offset, values, pos, count);
}
}
}