(KiriKiri): another encryption scheme.

This commit is contained in:
morkt 2016-07-23 02:47:07 +04:00
parent d7b4a7d6bb
commit 6cdea59ca4
2 changed files with 31 additions and 0 deletions

View File

@ -666,4 +666,34 @@ namespace GameRes.Formats.KiriKiri
Decrypt (entry, offset, values, pos, count);
}
}
[Serializable]
public class HibikiCrypt : ICrypt
{
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
if (0 != (offset & 4) || offset <= 0x64)
return (byte)(value ^ (entry.Hash >> 5));
else
return (byte)(value ^ (entry.Hash >> 8));
}
public override void Decrypt (Xp3Entry entry, long offset, byte[] buffer, int pos, int count)
{
byte key1 = (byte)(entry.Hash >> 5);
byte key2 = (byte)(entry.Hash >> 8);
for (int i = 0; i < count; ++i, ++offset)
{
if (0 != (offset & 4) || offset <= 0x64)
buffer[pos+i] ^= key1;
else
buffer[pos+i] ^= key2;
}
}
public override void Encrypt (Xp3Entry entry, long offset, byte[] buffer, int pos, int count)
{
Decrypt (entry, offset, buffer, pos, count);
}
}
}

View File

@ -238,6 +238,7 @@ Imouto Style<br/>
Inaho no Mirai<br/>
Karakara<br/>
Kourin no Machi, Lavender no Shoujo<br/>
LOVELY x CATION<br/>
Mayoeru Futari to Sekai no Subete<br/>
Mahoutsukai no Yoru<br/>
Nakadashi Hara Maid series<br/>