mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(NephriteCrypt): another KiriKiri encryption scheme.
This commit is contained in:
parent
97aac515f6
commit
83fa48b71d
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user