another XP3 encryption scheme.

This commit is contained in:
morkt
2016-01-12 02:25:00 +04:00
parent fa5015c1e8
commit 632d4b4602
2 changed files with 28 additions and 1 deletions

View File

@@ -1264,4 +1264,27 @@ NextEntry:
Decrypt (entry, offset, values, pos, count);
}
}
[Serializable]
public class IncubusCrypt : ICrypt
{
public override byte Decrypt (Xp3Entry entry, long offset, byte value)
{
return (byte)~(value ^ (entry.Hash + 1));
}
public override void Decrypt (Xp3Entry entry, long offset, byte[] values, int pos, int count)
{
byte key = (byte)~(entry.Hash + 1);
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);
}
}
}