Skip to content

Commit

Permalink
[pro] cmf for 132585 (for 132779)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingBallyhoo committed Nov 27, 2024
1 parent c2f080a commit 1d1da15
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 0 deletions.
83 changes: 83 additions & 0 deletions TACTLib/Core/Product/Tank/CMF/ProCMF_132585.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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_132585 : 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)];
switch (SignedMod(kidx, 3))
{
case 0:
kidx += 103;
break;
case 1:
kidx = (uint)SignedMod(kidx * 4, header.m_buildVersion);
break;
case 2:
--kidx;
break;
}
}
return buffer;
}

public byte[] IV(CMFHeader header, byte[] digest, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = (uint)(2 * digest[5]);
for (int i = 0; i != length; ++i)
{
buffer[i] = Keytable[SignedMod(kidx, 512)];
kidx -= header.m_buildVersion & 511;
buffer[i] ^= digest[SignedMod(kidx + header.m_buildVersion, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0xC6, 0x9F, 0xC4, 0xFA, 0x22, 0xD4, 0x16, 0xC6, 0x08, 0xD3, 0x5F, 0x0F, 0x24, 0xC2, 0xB4, 0x38,
0x92, 0x0D, 0xAB, 0x47, 0xD2, 0xC0, 0x81, 0x3A, 0x9B, 0x27, 0x63, 0xD9, 0xC3, 0xA3, 0x91, 0x2C,
0xEE, 0x1E, 0xEB, 0x17, 0x21, 0xAE, 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, 0xB6, 0x1D, 0xF5, 0xB8, 0x6D, 0x93, 0xC9, 0x19, 0xD9, 0x8D, 0x14, 0x79, 0x75,
0x62, 0x12, 0x4D, 0x0F, 0x6F, 0xE3, 0x53, 0x78, 0xA5, 0xCC, 0xF3, 0x0E, 0x8D, 0x27, 0x99, 0x72,
0x7D, 0x69, 0xA7, 0xC6, 0x58, 0x1E, 0x5F, 0xB8, 0x2A, 0x13, 0x19, 0x39, 0x3D, 0xF0, 0x3F, 0x09,
0x77, 0x16, 0x4A, 0x0C, 0x96, 0xE7, 0x86, 0x5B, 0xE8, 0x9C, 0x9B, 0x38, 0x3B, 0x76, 0xF9, 0x86,
0x43, 0xE3, 0xAE, 0x0B, 0xA6, 0xF5, 0xEA, 0x30, 0x1F, 0xCD, 0x43, 0xD1, 0xDA, 0x59, 0xA0, 0x24,
0x6C, 0x40, 0x03, 0x70, 0x7A, 0x4B, 0x58, 0x5E, 0xD7, 0x8C, 0x44, 0x45, 0x52, 0x29, 0x76, 0x83,
0x28, 0x69, 0xDA, 0x26, 0xF8, 0x3C, 0x86, 0xFA, 0xC3, 0x55, 0x59, 0xA7, 0xB3, 0x49, 0xB8, 0xEF
};
}
}
83 changes: 83 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_132585.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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_132585 : 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)];
switch (SignedMod(kidx, 3))
{
case 0:
kidx += 1273;
break;
case 1:
kidx = (uint)SignedMod(kidx * 4, header.m_buildVersion);
break;
case 2:
kidx -= 17;
break;
}
}
return buffer;
}

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

private static readonly byte[] Keytable =
{
0xC6, 0x9F, 0xC4, 0xFA, 0x22, 0xD4, 0x16, 0xC6, 0x08, 0xD3, 0x5F, 0x0F, 0x24, 0xC2, 0xB4, 0x38,
0x92, 0x0D, 0xAB, 0x47, 0xD2, 0xC0, 0x81, 0x3A, 0x9B, 0x27, 0x63, 0xD9, 0xC3, 0xA3, 0x91, 0x2C,
0xEE, 0x1E, 0xEB, 0x17, 0x21, 0xAE, 0x78, 0xBA, 0x94, 0x90, 0xA2, 0x16, 0xB9, 0x33, 0xAE, 0x7A,
0x23, 0x81, 0xA2, 0xD5, 0xB6, 0xCD, 0xAD, 0xFB, 0x50, 0x19, 0x8E, 0x8D, 0x69, 0x6A, 0xB5, 0x05,
0x02, 0xD8, 0x94, 0x5B, 0x0F, 0x85, 0x6D, 0xF7, 0xC6, 0x46, 0x15, 0xD0, 0xFA, 0xBF, 0xBB, 0x20,
0xDC, 0x29, 0x44, 0xE7, 0x22, 0x7C, 0x0C, 0x19, 0x32, 0x48, 0xA3, 0x03, 0xF4, 0xA6, 0xFA, 0x95,
0x43, 0x1E, 0x1E, 0xA1, 0x9F, 0x39, 0xFA, 0xC4, 0x75, 0xC5, 0x71, 0xE7, 0xBC, 0x11, 0x7F, 0x05,
0x67, 0x63, 0xEA, 0xC7, 0xFA, 0x41, 0xEA, 0x8F, 0x57, 0xE1, 0x12, 0x5A, 0x21, 0x09, 0x77, 0xA1,
0x9F, 0x11, 0xF5, 0x67, 0x85, 0xC4, 0xEC, 0x4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