| Line 1: | 
Line 1: | 
| − | packlist.dat is a file in the "Packs" folder in the TrackMania installation directory. It contains the encryption keys for the [[PAK|.pak files]] there.  | + | {{DISPLAYTITLE:packlist.dat}}  | 
|   | + | '''{{c|packlist.dat}}''' is a file in the "Packs" folder in the TrackMania installation directory. It contains the encryption keys for the [[PAK|.pak files]] there.  | 
|   | + |    | 
|   | + | There is no equivalent file for ManiaPlanet.  | 
|   | + |    | 
|   | + | == File structure ==  | 
|   |  |   |  | 
| − | ==File structure==
  |   | 
|   | * byte version (currently 1)  |   | * byte version (currently 1)  | 
|   | * byte numPacks  |   | * byte numPacks  | 
| Line 19: | 
Line 23: | 
|   |   for (int i = 0; i < nameLength; i++)  |   |   for (int i = 0; i < nameLength; i++)  | 
|   |       name[i] = encryptedName[i] ^ nameKey[i % 16];  |   |       name[i] = encryptedName[i] ^ nameKey[i % 16];  | 
| − |    | + |    | 
|   |   keyStringKey = md5(name + sprintf("%u", salt) + "B97C1205648A66E04F86A1B5D5AF9862")  |   |   keyStringKey = md5(name + sprintf("%u", salt) + "B97C1205648A66E04F86A1B5D5AF9862")  | 
|   |   for (int i = 0; i < 0x20; i++)  |   |   for (int i = 0; i < 0x20; i++)  | 
|   |       keyString[i] = encryptedKeyString[i] ^ keyStringKey[i % 16];  |   |       keyString[i] = encryptedKeyString[i] ^ keyStringKey[i % 16];  | 
|   | + |    | 
|   | + |  key = md5(keyString + "NadeoPak")  | 
|   |  |   |  | 
| − |  key = md5(keyString + "NadeoPak")
  | + | {{c|name}} corresponds to the name of a .pak file, minus the extension. {{c|key}} is the 16-byte key used during Blowfish decryption of the .pak file.  | 
|   |  |   |  | 
| − | "name" corresponds to the name of a .pak file, minus the extension. "key" is the 16-byte key used during Blowfish decryption of the .pak file.
  | + | == Signature verification ==  | 
|   |  |   |  | 
| − | ==Signature verification==
  | + | {{c|packlist.dat}} has a 16-byte signature at the end for integrity checking. It is verified as follows:  | 
| − | packlist.dat has a 16-byte signature at the end for integrity checking. It is verified as follows:  |   | 
|   |  |   |  | 
|   |   md5In = md5("E3554B5828AF14F11AA42A5EAF0AEFC8" + sprintf("%u", salt));  |   |   md5In = md5("E3554B5828AF14F11AA42A5EAF0AEFC8" + sprintf("%u", salt));  | 
| Line 42: | 
Line 47: | 
|   |  |   |  | 
|   | The calculated signature must match the signature in the file, or TrackMania will not accept the file.  |   | The calculated signature must match the signature in the file, or TrackMania will not accept the file.  | 
|   | + |  | 
|   | + | [[Category:Internals]]  |