diff --git a/ArcFormats/KiriKiri/CryptAlgorithms.cs b/ArcFormats/KiriKiri/CryptAlgorithms.cs index 9ec00cb6..beb1846e 100644 --- a/ArcFormats/KiriKiri/CryptAlgorithms.cs +++ b/ArcFormats/KiriKiri/CryptAlgorithms.cs @@ -850,6 +850,27 @@ namespace GameRes.Formats.KiriKiri } } + // reminder: + // locate virtual table, then find constructor where it's referenced. + [Serializable] + public class YuzuCrypt : ICrypt + { + public override void Decrypt (Xp3Entry entry, long offset, byte[] data, int pos, int count) + { + uint hash = entry.Hash ^ 0x1DDB6E7A; + byte key = (byte)(hash ^ (hash >> 8) ^ (hash >> 16) ^ (hash >> 24)); + if (0 == key) + key = 0xD0; + for (int i = 0; i < count; ++i) + data[pos+i] ^= key; + } + + public override void Encrypt (Xp3Entry entry, long offset, byte[] data, int pos, int count) + { + Decrypt (entry, offset, data, pos, count); + } + } + [Serializable] public class HighRunningCrypt : ICrypt {