diff --git a/ArcFormats/KiriKiri/CryptAlgorithms.cs b/ArcFormats/KiriKiri/CryptAlgorithms.cs index ad473cc7..cea7eca2 100644 --- a/ArcFormats/KiriKiri/CryptAlgorithms.cs +++ b/ArcFormats/KiriKiri/CryptAlgorithms.cs @@ -1671,4 +1671,23 @@ private byte[] InitKey(uint hash) } } + [Serializable] + public class HoneyCombCrypt : ICrypt + { + public override void Decrypt(Xp3Entry entry, long offset, byte[] buffer, int pos, int count) + { + uint seed = entry.Hash ^ 0xABCD9876; + byte key = (byte)((seed >> 24) ^ (seed >> 16) ^ (seed >> 8) ^ seed); + if (key == 0) + key = 0xA5; + for (int i = 0; i < count; ++i) + buffer[pos + i] ^= key; + } + + public override void Encrypt(Xp3Entry entry, long offset, byte[] values, int pos, int count) + { + Decrypt(entry, offset, values, pos, count); + } + } + }