mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(KiriKiri): added another encryption algorithm.
This commit is contained in:
parent
eb61ca6861
commit
5c7170f9c9
@ -581,11 +581,13 @@ namespace GameRes.Formats.KiriKiri
|
||||
{
|
||||
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
|
||||
{
|
||||
return (byte)(value ^ (entry.Hash >> 12));
|
||||
return offset < 5 ? value : (byte)(value ^ (entry.Hash >> 12));
|
||||
}
|
||||
|
||||
public override void Decrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
|
||||
{
|
||||
if (offset < 5)
|
||||
return;
|
||||
byte key = (byte)(entry.Hash >> 12);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
@ -636,4 +638,27 @@ namespace GameRes.Formats.KiriKiri
|
||||
return Math.Min (entry.Size, 0x100u);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SourireCrypt : ICrypt
|
||||
{
|
||||
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
|
||||
{
|
||||
return (byte)(value ^ entry.Hash ^ 0xCD);
|
||||
}
|
||||
|
||||
public override void Decrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
|
||||
{
|
||||
byte key = (byte)(entry.Hash ^ 0xCD);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
values[pos+i] ^= key;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Encrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
|
||||
{
|
||||
Decrypt (entry, offset, values, pos, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user