Skip to content

Commit

Permalink
[pro]: cmf for 119560
Browse files Browse the repository at this point in the history
  • Loading branch information
PistonFX committed Dec 13, 2023
1 parent 892250e commit 4d9d6a4
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 0 deletions.
72 changes: 72 additions & 0 deletions TACTLib/Core/Product/Tank/CMF/ProCMF_119560.cs
Original file line number Diff line number Diff line change
@@ -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_119560 : ICMFEncryptionProc
{
public byte[] Key(CMFHeader header, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = Keytable[header.m_buildVersion & 511];
for (uint i = 0; i != length; ++i)
{
buffer[i] = Keytable[SignedMod(kidx, 512)];
kidx += 3;
}
return buffer;
}

public byte[] IV(CMFHeader header, byte[] digest, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = (uint)(length * header.m_buildVersion);
for (int i = 0; i != length; ++i)
{
buffer[i] = Keytable[SignedMod(kidx, 512)];
kidx += ((uint)header.m_dataCount + digest[SignedMod(header.m_dataCount, SHA1_DIGESTSIZE)]) % 17;
buffer[i] = digest[SignedMod(kidx, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0xBE, 0xC5, 0x94, 0x7C, 0x56, 0xD9, 0x9B, 0x89, 0x11, 0xCC, 0xF8, 0xE5, 0x6A, 0x09, 0x90, 0x10,
0x1A, 0xD4, 0x54, 0x9A, 0xFB, 0x9A, 0x20, 0x78, 0xFF, 0xFE, 0xCB, 0x0B, 0xDF, 0xC2, 0x5A, 0x9B,
0xFE, 0x31, 0xB2, 0x91, 0x3B, 0x09, 0xEF, 0x22, 0x73, 0x80, 0xCA, 0x99, 0x6A, 0xB0, 0xC8, 0x97,
0xD4, 0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0D, 0xD3, 0xE2, 0x6A, 0x0C,
0x65, 0x80, 0xBF, 0x6D, 0x2B, 0xCA, 0xC6, 0xDE, 0x31, 0x62, 0x85, 0x46, 0x05, 0xFF, 0x7F, 0x0B,
0x1A, 0x9C, 0xCF, 0x54, 0x26, 0xC1, 0xFD, 0x86, 0x4F, 0xDB, 0xD9, 0x28, 0xC7, 0xFC, 0x86, 0x7A,
0x89, 0x12, 0x77, 0x87, 0xF0, 0x20, 0xBC, 0xC6, 0xAA, 0x12, 0x90, 0x49, 0x9D, 0x1F, 0xD0, 0x06,
0x95, 0x4F, 0x25, 0x22, 0xB0, 0x4E, 0xFA, 0x2F, 0xFC, 0x68, 0x47, 0xC0, 0x40, 0x97, 0x9D, 0x1B,
0x16, 0x0E, 0xEA, 0xCE, 0x7D, 0x1F, 0xED, 0x29, 0x55, 0xF3, 0x7F, 0x71, 0xBA, 0xFF, 0x16, 0x98,
0x21, 0x68, 0x43, 0x83, 0xDF, 0xBB, 0x45, 0x82, 0xF3, 0x4A, 0x69, 0x50, 0x2B, 0xD6, 0x42, 0x10
};
}
}
72 changes: 72 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_119560.cs
Original file line number Diff line number Diff line change
@@ -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_119560 : ITRGEncryptionProc
{
public byte[] Key(TRGHeader header, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = Keytable[header.m_buildVersion & 511];
for (uint i = 0; i != length; ++i)
{
buffer[i] = Keytable[SignedMod(kidx, 512)];
kidx += 3;
}
return buffer;
}

public byte[] IV(TRGHeader header, byte[] digest, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = (uint)(length * header.m_buildVersion);
for (int i = 0; i != length; ++i)
{
buffer[i] = Keytable[SignedMod(kidx, 512)];
kidx += (uint)header.m_packageCount + digest[SignedMod(header.m_packageCount, SHA1_DIGESTSIZE)];
buffer[i] = digest[SignedMod(kidx, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0xBE, 0xC5, 0x94, 0x7C, 0x56, 0xD9, 0x9B, 0x89, 0x11, 0xCC, 0xF8, 0xE5, 0x6A, 0x09, 0x90, 0x10,
0x1A, 0xD4, 0x54, 0x9A, 0xFB, 0x9A, 0x20, 0x78, 0xFF, 0xFE, 0xCB, 0x0B, 0xDF, 0xC2, 0x5A, 0x9B,
0xFE, 0x31, 0xB2, 0x91, 0x3B, 0x09, 0xEF, 0x22, 0x73, 0x80, 0xCA, 0x99, 0x6A, 0xB0, 0xC8, 0x97,
0xD4, 0x56, 0x08, 0xEE, 0x08, 0x2E, 0xE7, 0xF1, 0x75, 0xC7, 0x86, 0x1B, 0x43, 0x99, 0x06, 0xB5,
0x97, 0x71, 0x2E, 0xBA, 0x27, 0xFD, 0x7B, 0x95, 0xFA, 0x3A, 0xF7, 0x7C, 0x46, 0xBA, 0x5D, 0xA6,
0xDA, 0x5D, 0xBA, 0x8F, 0xAC, 0xA9, 0x4C, 0x3A, 0x8F, 0x1F, 0xCE, 0x81, 0xC4, 0x17, 0x46, 0x1A,
0x41, 0x5A, 0x8C, 0x5C, 0xEE, 0x32, 0x34, 0x89, 0x72, 0xB0, 0x7B, 0xFF, 0x8C, 0x9A, 0x50, 0x5E,
0x75, 0xA0, 0xCF, 0x53, 0x7C, 0xDD, 0x4E, 0x16, 0x87, 0x1B, 0x37, 0xBE, 0xCF, 0xB1, 0x77, 0x2C,
0x96, 0x40, 0x0F, 0x52, 0x18, 0xF9, 0xE0, 0xC8, 0xDA, 0x4A, 0x9B, 0xEA, 0x96, 0x22, 0xDB, 0x78,
0x60, 0xBF, 0x1D, 0x35, 0x8C, 0xCA, 0x59, 0xAA, 0x42, 0xC5, 0x12,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