Skip to content

Commit

Permalink
[pro] cmf for 129701
Browse files Browse the repository at this point in the history
  • Loading branch information
Js41637 committed Sep 19, 2024
1 parent c0a03a8 commit d7f035b
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_129701.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_129701 : 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)];
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 += 3;
buffer[i] ^= digest[SignedMod(kidx - i, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0x38, 0x6F, 0x03, 0xEA, 0x84, 0x7D, 0x36, 0xDA, 0x0A, 0xCA, 0xB1, 0xF5, 0xD8, 0x97, 0x15, 0x9E,
0x7F, 0xAF, 0x05, 0xB7, 0x86, 0x12, 0x92, 0x8E, 0x67, 0xA1, 0x25, 0xD5, 0x09, 0x5F, 0xA3, 0xF3,
0xF7, 0x68, 0xE3, 0x8C, 0xCC, 0x8F, 0xDE, 0x10, 0x06, 0x64, 0x5D, 0x39,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0x6C, 0xAA, 0x17, 0xB3, 0x27, 0xB7, 0x06, 0x5B,
0xF8, 0x23, 0x03, 0xA9, 0xA0, 0x07, 0xA8, 0xB8, 0xF9, 0xF7, 0x3D, 0x8E, 0x3C, 0xEE, 0x66, 0xAC,
0x99, 0x4E, 0x9D, 0x0D, 0x57, 0xC9, 0x51, 0x3A, 0x98, 0x14, 0x19, 0x1D, 0x37, 0x81, 0x7A, 0x6C,
0x26, 0x35, 0x60, 0x24, 0xC0, 0xCF, 0x95, 0x68, 0x14, 0x92, 0x8A, 0xD6, 0xF4, 0x10, 0xCD, 0x3F,
0x26, 0x48, 0xB2, 0x2B, 0xCE, 0xC7, 0xFD, 0x44, 0x7B, 0x7C, 0x07, 0xA7, 0xB2, 0x70, 0x5B, 0xE0,
0x39, 0xDF, 0xD9, 0x1C, 0x4C, 0x02, 0x8D, 0x3A, 0x6F, 0xC0, 0x1D, 0xBE, 0xE8, 0x65, 0x62, 0xA8,
0xA6, 0xB4, 0x84, 0xEE, 0x18, 0xF1, 0x62, 0x51, 0xDF, 0xFB, 0xBD, 0xD1, 0x9E, 0x7F, 0x60, 0xD1
};
}
}
83 changes: 83 additions & 0 deletions TACTLib/Core/Product/Tank/TRG/ProTRG_129701.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_129701 : 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)];
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 += 3;
buffer[i] ^= digest[SignedMod(kidx - i, SHA1_DIGESTSIZE)];
}
return buffer;
}

private static readonly byte[] Keytable =
{
0x38, 0x6F, 0x03, 0xEA, 0x84, 0x7D, 0x36, 0xDA, 0x0A, 0xCA, 0xB1, 0xF5, 0xD8, 0x97, 0x15, 0x9E,
0x7F, 0xAF, 0x05, 0xB7, 0x86, 0x12, 0x92, 0x8E, 0x67, 0xA1, 0x25, 0xD5, 0x09, 0x5F, 0xA3, 0xF3,
0xF7, 0x68, 0xE3, 0x8C, 0xCC, 0x8F, 0xDE, 0x10, 0x06, 0x64, 0x5D, 0x39, 0xD9, 0x07, 0xB6, 0x94,
0x19, 0x43, 0x9C, 0x20, 0xFC, 0x0C, 0xC0, 0xB9, 0xE3, 0xA5, 0xCB, 0x8E, 0x7E, 0xDC, 0x4C, 0x79,
0xBC, 0xB1, 0x54, 0xDD, 0x07, 0x93, 0x3A, 0x7B, 0xBB, 0x79, 0x3D, 0x55, 0x73, 0x7E, 0x95, 0x49,
0xA9, 0xB5, 0x2F, 0xE6, 0x4F, 0x41, 0x9B, 0x91, 0x99, 0x0D, 0xEF, 0xFA, 0x0F, 0xBA, 0x84, 0x11,
0x72, 0xC9, 0xC1, 0x99, 0x1A, 0xF4, 0x57, 0x4C, 0x3F, 0xE3, 0x00, 0x0A, 0xB8, 0xE3, 0x59, 0x5E,
0x40, 0x15, 0xA6, 0x49, 0xA7, 0x99, 0xB1, 0xE5, 0x5D, 0xC5, 0x37, 0xD8, 0xC7, 0x92, 0xBD, 0xFE,
0xAF, 0x2A, 0x48, 0xA7, 0x49, 0x5E, 0x1C, 0x83, 0xE4, 0x82, 0x6B, 0xAC, 0xBC, 0x5C, 0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 0xD1, 0x9E, 0x7F, 0x60, 0xD1
};
}
}

0 comments on commit d7f035b

Please sign in to comment.