Skip to content

Commit

Permalink
[pro] cmf for 130220
Browse files Browse the repository at this point in the history
  • Loading branch information
Js41637 committed Oct 4, 2024
1 parent d7f035b commit 6bc3c6c
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_130220.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_130220 : 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 += okidx % 61;
}
return buffer;
}

public byte[] IV(CMFHeader header, byte[] digest, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = (uint)(digest[7] + header.m_dataCount) & 511;
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 =
{
0xBD, 0xBD, 0xF9, 0x06, 0x09, 0x2A, 0x71, 0xC1, 0x11, 0xE4, 0xAE, 0xF3, 0xB1, 0xD6, 0x9D, 0x7C,
0xE7, 0x41, 0x54, 0x14, 0x00, 0x67, 0x19, 0x3C, 0x47, 0xB5, 0xD7, 0x5E, 0x90, 0xC0, 0xAC, 0xE4,
0x1A, 0x97, 0x22, 0x69, 0xFC, 0xA3, 0x86, 0x91, 0x4B, 0xEB, 0xF7, 0xF6, 0xBF, 0x2B, 0x3A, 0x9F,
0xAB, 0x7A, 0xD5, 0x93,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xE3, 0x24,
0xA1, 0x60, 0x28, 0x48, 0x56, 0xE1, 0xE6, 0xE1, 0x58, 0xDF, 0xBD, 0xD8, 0x45, 0xEA, 0x48, 0x3F,
0xC8, 0xC5, 0xE3, 0x3D, 0x81, 0xD8, 0xEB, 0x02, 0x47, 0x95, 0xEF, 0x32, 0xBB, 0x99, 0xA0, 0x4D,
0x87, 0xD8, 0x7E, 0xD9, 0x8A, 0x4D, 0x0B, 0xE1, 0xE8, 0x80, 0x8B, 0x9F, 0x77, 0x7D, 0xED, 0x5A,
0xE3, 0x1E, 0xFE, 0xE8, 0xB7, 0xAB, 0xF9, 0x44, 0x21, 0x18, 0xA1, 0x42, 0x24, 0xBA, 0x24, 0xEC,
0x7E, 0x0C, 0x47, 0xBE, 0xA5, 0x9B, 0xAE, 0xF8, 0xB2, 0x52, 0xFF, 0x16, 0x60, 0x89, 0xAB, 0xD3,
0xE4, 0x98, 0x48, 0x5B, 0xE0, 0x15, 0x13, 0x10, 0x29, 0xA6, 0xB1, 0x00, 0x3D, 0x6A, 0xBE, 0xF9
};
}
}
72 changes: 72 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_130220.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_130220 : 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 += okidx % 61;
}
return buffer;
}

public byte[] IV(TRGHeader header, byte[] digest, int length)
{
byte[] buffer = new byte[length];
uint kidx, okidx;
kidx = okidx = (uint)(digest[5] + header.m_skinCount) & 511;
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 =
{
0xBD, 0xBD, 0xF9, 0x06, 0x09, 0x2A, 0x71, 0xC1, 0x11, 0xE4, 0xAE, 0xF3, 0xB1, 0xD6, 0x9D, 0x7C,
0xE7, 0x41, 0x54, 0x14, 0x00, 0x67, 0x19, 0x3C, 0x47, 0xB5, 0xD7, 0x5E, 0x90, 0xC0, 0xAC, 0xE4,
0x1A, 0x97, 0x22, 0x69, 0xFC, 0xA3, 0x86, 0x91, 0x4B, 0xEB, 0xF7, 0xF6, 0xBF, 0x2B, 0x3A, 0x9F,
0xAB, 0x7A, 0xD5, 0x93, 0xC1, 0x5E, 0xEB, 0xD8, 0x5F, 0xBD, 0xAA, 0x49, 0xEC, 0x60, 0x0F, 0x7F,
0xCF, 0x88, 0x2D, 0x0A, 0xC2, 0xF5, 0x27, 0x26, 0x71, 0x25, 0x94, 0x59, 0xC8, 0x67, 0xE2, 0xE7,
0x2A, 0xBC, 0x93, 0xB7, 0x3D, 0xED, 0x3A, 0x89, 0xF1, 0x8D, 0x5D, 0x4B, 0x54, 0xB5, 0x0C, 0x87,
0x8F, 0xFF, 0x9A, 0x8A, 0x71, 0x16, 0x92, 0xF5, 0x28, 0xD9, 0xB0, 0xE3, 0x50, 0x9D, 0x72, 0x97,
0xC9, 0x7B, 0x55, 0xE9, 0xDC, 0xD2, 0xFE, 0xEA, 0xAA, 0x97, 0xA7, 0x61, 0xC6, 0x9C, 0x5E, 0x89,
0x6D, 0xA4, 0x13, 0x6F, 0xDE, 0x05, 0x56, 0x46, 0x58, 0x77, 0x64, 0x6B, 0x07, 0x15, 0x97, 0xDD,
0x81, 0x6E, 0x5F, 0xCB, 0xBA, 0x65, 0x59, 0xDC, 0x7B, 0xDB, 0xFB, 0xD4, 0x73, 0x1C,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