Skip to content

Commit

Permalink
[pro] cmf for 131376
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingBallyhoo committed Nov 1, 2024
1 parent 4fbd8ef commit d1d907c
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_131376.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_131376 : 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 += 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 = header.m_buildVersion - kidx;
buffer[i] ^= digest[SignedMod(kidx + i, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0xFF, 0x8F, 0x09, 0x82, 0x7B, 0x77, 0xFE, 0x82, 0x6C, 0x96, 0x71, 0x72, 0xDF, 0x81, 0x0F, 0x7B,
0xCC, 0x23, 0x1F, 0xAC, 0x5E, 0xC6, 0xD3, 0xAB, 0x04, 0x16, 0xF8, 0xD8, 0xCA, 0xAA, 0x91, 0x4C,
0x1C, 0x4B, 0x22, 0x41, 0x77, 0x9D, 0xBB, 0x44, 0xED, 0x31, 0x8B, 0x8D, 0xAF, 0x16, 0x08, 0x38,
0x97, 0x97, 0xFF, 0xBE, 0x13, 0x2D, 0x58, 0x73,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x18, 0x87, 0x5D, 0xBE, 0x27, 0xC9, 0x5A, 0xA7, 0x2A, 0x7A, 0x65,
0xB1, 0x84, 0x5D, 0x65, 0xEF, 0xC8, 0xE5, 0xDC, 0x1A, 0xC4, 0x95, 0x09, 0x9F, 0x70, 0xAB, 0xB4,
0xBC, 0xBD, 0x28, 0xBC, 0xD1, 0x5D, 0x36, 0xFC, 0x8D, 0xD0, 0x15, 0xE0, 0x66, 0x10, 0x47, 0xD4,
0x7F, 0xD6, 0x37, 0x9C, 0x4C, 0x80, 0x7B, 0xF7, 0x4A, 0xF2, 0xC5, 0x24, 0xF6, 0xF7, 0x22, 0x49,
0xED, 0x85, 0xFB, 0xB7, 0x63, 0x7D, 0xE5, 0x87, 0xCA, 0x6D, 0x91, 0x9F, 0x10, 0x36, 0x8F, 0xE9,
0x42, 0xE6, 0xB9, 0x15, 0x19, 0x2D, 0xD6, 0xC1, 0x87, 0x05, 0x89, 0x56, 0xC3, 0x1D, 0x20, 0x64
};
}
}
72 changes: 72 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_131376.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_131376 : 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 += 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 = header.m_buildVersion - kidx;
buffer[i] ^= digest[SignedMod(kidx + i, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0xFF, 0x8F, 0x09, 0x82, 0x7B, 0x77, 0xFE, 0x82, 0x6C, 0x96, 0x71, 0x72, 0xDF, 0x81, 0x0F, 0x7B,
0xCC, 0x23, 0x1F, 0xAC, 0x5E, 0xC6, 0xD3, 0xAB, 0x04, 0x16, 0xF8, 0xD8, 0xCA, 0xAA, 0x91, 0x4C,
0x1C, 0x4B, 0x22, 0x41, 0x77, 0x9D, 0xBB, 0x44, 0xED, 0x31, 0x8B, 0x8D, 0xAF, 0x16, 0x08, 0x38,
0x97, 0x97, 0xFF, 0xBE, 0x13, 0x2D, 0x58, 0x73, 0xD3, 0x88, 0x8F, 0x09, 0x13, 0x79, 0x6F, 0x99,
0xA0, 0xE5, 0x23, 0xE0, 0x86, 0x52, 0xAB, 0x58, 0xCD, 0xF6, 0x34, 0xB8, 0x19, 0xC0, 0xE8, 0x75,
0x50, 0x28, 0x4A, 0x78, 0xA3, 0x99, 0x1A, 0x33, 0x95, 0x04, 0xC3, 0xE7, 0x71, 0xA0, 0x99, 0x55,
0xCE, 0xE0, 0x5A, 0x4A, 0xE9, 0x59, 0xD2, 0x3E, 0x27, 0x90, 0xD8, 0x35, 0x55, 0x14, 0x42, 0xDF,
0x75, 0xC3, 0x14, 0xDE, 0xB4, 0xB1, 0xB6, 0x64, 0xCE, 0x35, 0x17, 0x96, 0xC2, 0x2B, 0xF6, 0x3C,
0x4B, 0x4D, 0x53, 0xA1, 0x66, 0x0D, 0x4D, 0xD7, 0x44, 0xBA, 0x4B, 0x40, 0xEC, 0x08, 0x0F, 0x51,
0x5D, 0xBE, 0xFC, 0xA4, 0x62, 0xAE, 0x99, 0x75, 0x7C, 0x20, 0x04, 0x49, 0x13, 0x4A, 0xD5, 0xEF,
0xAA, 0xB2, 0x03, 0xFE, 0x0A, 0x7D, 0x80, 0x2F, 0xFC, 0x1B, 0x50, 0x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 0xA6, 0x7D, 0x95, 0x23, 0xFA, 0xDB, 0x62, 0xE6, 0x36, 0xE8, 0xB6, 0xAF, 0xF6, 0xDD, 0x40,
0x65, 0x97, 0xFF, 0xD3, 0x8E, 0x31, 0x26, 0x19, 0xF1, 0x76, 0x25, 0xC6, 0x15, 0x35, 0x84, 0xE7,
0x8E, 0x21, 0xD1, 0x91, 0xEF, 0xC8, 0xB4, 0x44, 0xFA, 0x0E, 0xA1, 0xBE, 0x90, 0x0A, 0xE9, 0xF8,
0x14, 0x98, 0x34, 0xAC, 0xF6, 0xA8, 0x51, 0xE2, 0xD2, 0x0D, 0x75, 0xBF, 0xD8, 0x96, 0xC2, 0x72,
0xD1, 0xC8, 0xE1, 0x86, 0x69, 0x18, 0x87, 0x5D, 0xBE, 0x27, 0xC9, 0x5A, 0xA7, 0x2A, 0x7A, 0x65,
0xB1, 0x84, 0x5D, 0x65, 0xEF, 0xC8, 0xE5, 0xDC, 0x1A, 0xC4, 0x95, 0x09, 0x9F, 0x70, 0xAB, 0xB4,
0xBC, 0xBD, 0x28, 0xBC, 0xD1, 0x5D, 0x36, 0xFC, 0x8D, 0xD0, 0x15, 0xE0, 0x66, 0x10, 0x47, 0xD4,
0x7F, 0xD6, 0x37, 0x9C, 0x4C, 0x80, 0x7B, 0xF7, 0x4A, 0xF2, 0xC5, 0x24, 0xF6, 0xF7, 0x22, 0x49,
0xED, 0x85, 0xFB, 0xB7, 0x63, 0x7D, 0xE5, 0x87, 0xCA, 0x6D, 0x91, 0x9F, 0x10, 0x36, 0x8F, 0xE9,
0x42, 0xE6, 0xB9, 0x15, 0x19, 0x2D, 0xD6, 0xC1, 0x87, 0x05, 0x89, 0x56, 0xC3, 0x1D, 0x20, 0x64
};
}
}

0 comments on commit d1d907c

Please sign in to comment.