diff --git a/TACTLib/Core/Product/Tank/CMF/ProCMF_131896.cs b/TACTLib/Core/Product/Tank/CMF/ProCMF_131896.cs new file mode 100644 index 0000000..357f244 --- /dev/null +++ b/TACTLib/Core/Product/Tank/CMF/ProCMF_131896.cs @@ -0,0 +1,72 @@ +using static TACTLib.Core.Product.Tank.ManifestCryptoHandler; +using static TACTLib.Core.Product.Tank.ContentManifestFile; + +namespace TACTLib.Core.Product.Tank.CMF +{ + [ManifestCrypto(AutoDetectVersion = true, Product = TACTProduct.Overwatch)] + public class ProCMF_131896 : ICMFEncryptionProc + { + public byte[] Key(CMFHeader header, int length) + { + byte[] buffer = new byte[length]; + uint kidx, okidx; + kidx = okidx = Keytable[header.m_dataCount & 511]; + for (uint i = 0; i != length; ++i) + { + buffer[i] = Keytable[SignedMod(kidx, 512)]; + kidx -= header.m_buildVersion & 511; + } + return buffer; + } + + public byte[] IV(CMFHeader header, byte[] digest, int length) + { + byte[] buffer = new byte[length]; + uint kidx, okidx; + kidx = okidx = Keytable[header.m_dataCount & 511]; + for (int i = 0; i != length; ++i) + { + buffer[i] = Keytable[SignedMod(kidx, 512)]; + kidx += ((digest[6] & 1) != 0) ? 37 : (okidx % 61); + buffer[i] ^= digest[SignedMod(kidx - i, SHA1_DIGESTSIZE)]; + } + return buffer; + } + + private static readonly byte[] Keytable = + { + 0xB3, 0xF7, 0x4B, 0xB1, 0x28, 0xF4, 0x1D, 0xC9, 0x44, 0xCF, 0x0A, 0x2D, 0x09, 0xF4, 0x53, 0xC7, + 0x00, 0x6D, 0x44, 0x31, 0x8B, 0x42, 0x58, 0xF7, 0x75, 0x72, 0x6D, 0xF9, 0x4E, 0x72, 0xDE, 0xCC, + 0xF9, 0x62, 0x18, 0x15, 0x1A, 0xE4, 0x3A, 0xB1, 0x9B, 0x63, 0x33, 0xF0, 0x7F, 0x48, 0x57, 0xAF, + 0xD5, 0x9B, 0x73, 0xD9, 0x0B, 0x87, 0xB3, 0x44, 0x44, 0x41, 0x22, 0x9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 0x57, 0x3F, 0xEB, 0xE4, 0x79, 0x1E, 0xE5, 0xF2, 0xF6, + 0xB0, 0x37, 0xD8, 0xBD, 0x15, 0x80, 0xB5, 0x5A, 0xA1, 0x4C, 0xC6, 0xE9, 0xB6, 0xCE, 0xF6, 0x92, + 0xD0, 0x34, 0xB4, 0xA3, 0xA9, 0x1D, 0xA3, 0xD1, 0xFD, 0x76, 0xD1, 0x4E, 0x2A, 0x70, 0x54, 0x29, + 0xA8, 0x9F, 0x08, 0x42, 0x8A, 0x87, 0xBB, 0x4B, 0xBA, 0x7E, 0xC1, 0xC3, 0x82, 0xE6, 0xED, 0x46, + 0x36, 0x3F, 0x2D, 0x15, 0xAD, 0xB4, 0x74, 0x39, 0xBB, 0x06, 0xAA, 0xA7, 0xE0, 0x92, 0xCD, 0x11, + 0xC9, 0x95, 0xCE, 0x3F, 0x7B, 0xCC, 0xC4, 0x3E, 0x8B, 0x30, 0x19, 0xEE, 0xB8, 0x00, 0xB6, 0x8A + }; + } +} \ No newline at end of file diff --git a/TACTLib/Core/Product/Tank/TRG/ProTRG_131896.cs b/TACTLib/Core/Product/Tank/TRG/ProTRG_131896.cs new file mode 100644 index 0000000..2442e32 --- /dev/null +++ b/TACTLib/Core/Product/Tank/TRG/ProTRG_131896.cs @@ -0,0 +1,72 @@ +using static TACTLib.Core.Product.Tank.ManifestCryptoHandler; +using static TACTLib.Core.Product.Tank.ResourceGraph; + +namespace TACTLib.Core.Product.Tank.TRG +{ + [ManifestCrypto(AutoDetectVersion = true, Product = TACTProduct.Overwatch)] + public class ProTRG_131896 : ITRGEncryptionProc + { + public byte[] Key(TRGHeader header, int length) + { + byte[] buffer = new byte[length]; + uint kidx, okidx; + kidx = okidx = Keytable[header.m_skinCount & 511]; + for (uint i = 0; i != length; ++i) + { + buffer[i] = Keytable[SignedMod(kidx, 512)]; + kidx -= header.m_buildVersion & 511; + } + return buffer; + } + + public byte[] IV(TRGHeader header, byte[] digest, int length) + { + byte[] buffer = new byte[length]; + uint kidx, okidx; + kidx = okidx = Keytable[header.m_skinCount & 511]; + for (int i = 0; i != length; ++i) + { + buffer[i] = Keytable[SignedMod(kidx, 512)]; + kidx += okidx % 61; + buffer[i] ^= digest[SignedMod(kidx - i, SHA1_DIGESTSIZE)]; + } + return buffer; + } + + private static readonly byte[] Keytable = + { + 0xB3, 0xF7, 0x4B, 0xB1, 0x28, 0xF4, 0x1D, 0xC9, 0x44, 0xCF, 0x0A, 0x2D, 0x09, 0xF4, 0x53, 0xC7, + 0x00, 0x6D, 0x44, 0x31, 0x8B, 0x42, 0x58, 0xF7, 0x75, 0x72, 0x6D, 0xF9, 0x4E, 0x72, 0xDE, 0xCC, + 0xF9, 0x62, 0x18, 0x15, 0x1A, 0xE4, 0x3A, 0xB1, 0x9B, 0x63, 0x33, 0xF0, 0x7F, 0x48, 0x57, 0xAF, + 0xD5, 0x9B, 0x73, 0xD9, 0x0B, 0x87, 0xB3, 0x44, 0x44, 0x41, 0x22, 0x9A, 0xAB, 0x41, 0x28, 0xD0, + 0xBB, 0xE5, 0x5F, 0xF1, 0xFC, 0x1B, 0xC9, 0x7A, 0x91, 0xF2, 0xF1, 0xAA, 0x71, 0x1E, 0x38, 0x3D, + 0x60, 0x1F, 0x72, 0x1A, 0xD0, 0xED, 0x11, 0x92, 0x75, 0xC7, 0xD9, 0x31, 0x14, 0x7B, 0xB5, 0xD6, + 0xE4, 0x38, 0x20, 0x84, 0x5B, 0x58, 0x18, 0xCB, 0xB9, 0xB9, 0xB8, 0xF7, 0xB5, 0xC8, 0x83, 0xED, + 0x46, 0x3F, 0x2B, 0x38, 0x52, 0xBE, 0x4D, 0xA3, 0x56, 0x0A, 0xFB, 0x04, 0x0A, 0x1B, 0x5B, 0x80, + 0x65, 0x0A, 0x2B, 0xCA, 0x89, 0x00, 0x90, 0xFE, 0x1D, 0x57, 0xA7, 0x35, 0x38, 0x98, 0x8A, 0xDD, + 0x35, 0xBA, 0x1F, 0x7D, 0xBA, 0xDD, 0xC5, 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newline at end of file