mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
(DameganeCrypt): another decryption scheme.
This commit is contained in:
parent
0db69aea4e
commit
c5aee52d96
@ -92,6 +92,7 @@ namespace GameRes.Formats.KiriKiri
|
||||
{ arcStrings.ArcNoEncryption, NoCryptAlgorithm },
|
||||
{ "Cafe Sourire", new XorCrypt (0xcd) },
|
||||
{ "Coμ", new ComyuCrypt() },
|
||||
{ "Damegane", new DameganeCrypt() },
|
||||
{ "Fate/hollow ataraxia", new FateHACrypt() },
|
||||
{ "Fate/stay night", new FateCrypt() },
|
||||
{ "Imouto Style", new ImoutoStyleCrypt() },
|
||||
@ -1055,4 +1056,31 @@ NextEntry:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DameganeCrypt : ICrypt
|
||||
{
|
||||
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
|
||||
{
|
||||
if (0 != (offset & 1))
|
||||
return (byte)(value ^ entry.Hash);
|
||||
else
|
||||
return (byte)(value ^ offset);
|
||||
}
|
||||
|
||||
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)entry.Hash;
|
||||
else
|
||||
values[pos+i] ^= (byte)offset;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Encrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
|
||||
{
|
||||
Decrypt (entry, offset, values, pos, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user