Skip to content

Commit

Permalink
[pro] cmf for 128150
Browse files Browse the repository at this point in the history
  • Loading branch information
Js41637 committed Aug 1, 2024
1 parent ca77c46 commit 05b9da9
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_128150.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_128150 : 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 += (uint)header.m_dataCount;
}
return buffer;
}

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

private static readonly byte[] Keytable =
{
0xE2, 0x50, 0xE9, 0x9A, 0x55, 0x5B, 0x4B, 0x37, 0xA5, 0x44, 0xC7, 0xEE, 0xD5, 0x0B, 0x2E, 0xE0,
0x27, 0x4B, 0xB3, 0x07, 0xAD, 0xEF, 0x43, 0x1A, 0x0A, 0xF2, 0xBA, 0xD3, 0x14, 0x62, 0x98, 0xBF,
0xAA, 0x73, 0x76, 0x6C, 0xA8, 0xB7, 0x2F, 0x60, 0x48, 0xD5, 0xE2, 0xCC, 0xF6, 0xFA, 0xEA, 0xE9,
0xBB, 0xCE, 0x50, 0xE6, 0x4C, 0xC7, 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 0xC7, 0x09, 0x39, 0x3C, 0x0E, 0x2E, 0x77, 0x9F, 0x0D, 0x4B, 0x4E, 0x1D,
0xE6, 0x6A, 0xD6, 0x1D, 0x0E, 0x18, 0x45, 0xED, 0x89, 0x6E, 0x32, 0x25, 0x17, 0xC9, 0x4D, 0xA5,
0xA4, 0xBD, 0x47, 0xAD, 0x22, 0xFA, 0x8D, 0x2F, 0xE1, 0xDB, 0x34, 0x63, 0xB3, 0x68, 0x97, 0x02,
0x5D, 0x89, 0xCB, 0xFB, 0x7C, 0x8F, 0x38, 0x2F, 0x7B, 0xF3, 0x13, 0xB3, 0x4B, 0x59, 0xDA, 0xD0,
0x42, 0xDD, 0x75, 0x57, 0x22, 0xBE, 0xE1, 0x35, 0xC4, 0xF5, 0x47, 0x56, 0xC9, 0x48, 0xF2, 0x7C,
0x81, 0x9A, 0xE4, 0x9B, 0x78, 0x39, 0x8F, 0x70, 0xD3, 0xF5, 0xFF, 0xCD, 0xB7, 0xD0, 0x64, 0xFA
};
}
}
72 changes: 72 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_128150.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_128150 : 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 += (uint)header.m_packageCount;
}
return buffer;
}

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

private static readonly byte[] Keytable =
{
0xE2, 0x50, 0xE9, 0x9A, 0x55, 0x5B, 0x4B, 0x37, 0xA5, 0x44, 0xC7, 0xEE, 0xD5, 0x0B, 0x2E, 0xE0,
0x27, 0x4B, 0xB3, 0x07, 0xAD, 0xEF, 0x43, 0x1A, 0x0A, 0xF2, 0xBA, 0xD3, 0x14, 0x62, 0x98, 0xBF,
0xAA, 0x73, 0x76, 0x6C, 0xA8, 0xB7, 0x2F, 0x60, 0x48, 0xD5, 0xE2, 0xCC, 0xF6, 0xFA, 0xEA, 0xE9,
0xBB, 0xCE, 0x50, 0xE6, 0x4C, 0xC7, 0x11, 0x56, 0x1A, 0x79, 0x78, 0x16, 0x1E, 0x39, 0x95, 0xBA,
0x5E, 0xA1, 0x97, 0xC9, 0x41, 0xFD, 0x86, 0x49, 0x92, 0x57, 0xDD, 0x59, 0x52, 0x70, 0x4C, 0x1E,
0xB9, 0xAE, 0x52, 0x5F, 0x43, 0xA2, 0xEA, 0x5A, 0x08, 0x1C, 0x86, 0xB6, 0x0A, 0x81, 0x2C, 0xEF,
0x5F, 0x61, 0xE1, 0xD1, 0x15, 0xBC, 0x10, 0x98, 0x66, 0xF2, 0x55, 0x3F, 0xCD, 0x30, 0x6B, 0x23,
0x6F, 0x77, 0x65, 0x95, 0xC5, 0xE2, 0x7F, 0x9A, 0xCD, 0xFB, 0x59, 0x8B, 0xE6, 0xFE, 0xB4, 0x32,
0x67, 0x9C, 0x7B, 0xB5, 0xBC, 0x16, 0xDE, 0xBB, 0xA0, 0x0B, 0x26, 0xF0, 0xF1, 0xD6, 0xD4, 0x2E,
0x32, 0x95, 0x1A, 0x53, 0xCB, 0xE2, 0x78, 0xCC, 0x5B, 0xC6, 0xEE, 0x64, 0x26, 0x29, 0x0E, 0xFD,
0xFA, 0x89, 0x42, 0x9B, 0x56, 0xF2, 0x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x68, 0xF8, 0x64, 0x04,
0x6F, 0x1F, 0x40, 0xDA, 0xBB, 0x64, 0xB4, 0xAC, 0x0F, 0xCA, 0x17, 0x66, 0xB2, 0x6F, 0x03, 0x67,
0x5B, 0xAE, 0x07, 0x13, 0x39, 0x61, 0x93, 0xE0, 0x2F, 0xFE, 0xA7, 0x70, 0x80, 0x91, 0x25, 0x00,
0x67, 0x4D, 0x2A, 0x08, 0x26, 0xA5, 0xF5, 0x71, 0xF7, 0xCC, 0xBF, 0x2B, 0xC9, 0x57, 0x01, 0xD0,
0x32, 0x1E, 0x2C, 0x27, 0x0A, 0x43, 0x30, 0x0A, 0xA8, 0x2E, 0x18, 0x44, 0xFF, 0xA4, 0xA0, 0x95,
0x3B, 0x39, 0x3C, 0x1B, 0xC7, 0x09, 0x39, 0x3C, 0x0E, 0x2E, 0x77, 0x9F, 0x0D, 0x4B, 0x4E, 0x1D,
0xE6, 0x6A, 0xD6, 0x1D, 0x0E, 0x18, 0x45, 0xED, 0x89, 0x6E, 0x32, 0x25, 0x17, 0xC9, 0x4D, 0xA5,
0xA4, 0xBD, 0x47, 0xAD, 0x22, 0xFA, 0x8D, 0x2F, 0xE1, 0xDB, 0x34, 0x63, 0xB3, 0x68, 0x97, 0x02,
0x5D, 0x89, 0xCB, 0xFB, 0x7C, 0x8F, 0x38, 0x2F, 0x7B, 0xF3, 0x13, 0xB3, 0x4B, 0x59, 0xDA, 0xD0,
0x42, 0xDD, 0x75, 0x57, 0x22, 0xBE, 0xE1, 0x35, 0xC4, 0xF5, 0x47, 0x56, 0xC9, 0x48, 0xF2, 0x7C,
0x81, 0x9A, 0xE4, 0x9B, 0x78, 0x39, 0x8F, 0x70, 0xD3, 0xF5, 0xFF, 0xCD, 0xB7, 0xD0, 0x64, 0xFA
};
}
}

0 comments on commit 05b9da9

Please sign in to comment.