Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Pak: Difference between revisions

From Trackmania Wiki
m Compression diffs
m Do not mention the encryption order (yet)
Line 17: Line 17:
Pak files until the release of Forever games use version 3. This version always encrypts everything in the file, including the header. The only unencrypted information is the version itself and the Blowfish [https://en.wikipedia.org/wiki/Initialization%20vector initialization vector]. The key used to decrypt each of these Pak files is stored in the paklist.dat file located in the Packs directory of the installation, next to the other Pak files.
Pak files until the release of Forever games use version 3. This version always encrypts everything in the file, including the header. The only unencrypted information is the version itself and the Blowfish [https://en.wikipedia.org/wiki/Initialization%20vector initialization vector]. The key used to decrypt each of these Pak files is stored in the paklist.dat file located in the Packs directory of the installation, next to the other Pak files.


Individual files are first encrypted, then compressed using zlib.
Individual files are compressed using zlib.


=== From 2010 (version 6 to 18) ===
=== From 2010 (version 6 to 18) ===
Line 44: Line 44:
   headerKey = fileKey ^ 0xCE591D76EBFC7DA1N90BCB6DEBBCBEE56N
   headerKey = fileKey ^ 0xCE591D76EBFC7DA1N90BCB6DEBBCBEE56N


Individual files are first encrypted, then compressed using zlib up to version 17. From version 18, LZ4 is used.
Individual files are compressed using zlib up to version 17. From version 18, LZ4 is used.

Revision as of 02:17, 25 January 2026

Pak (PAK, or NadeoPak) is a proprietary file format used for packaging game content in encrypted form.

Pak files cannot be opened in any standard archiver. The majority of the package is encrypted with the Blowfish cipher. Individual files are then often compressed with either zlib or LZ4 algorithms.

The primary purpose of the Pak format is to conceal parts of the GameData directory behind a secure wall, significantly limiting the modification capabilities of the official game content. The format is also effective enough for keeping the content safe from infringement.

History

In the TrackMania series, the system of NadeoPak was first introduced in the TrackMania United release (not the Forever one). It was intended to replace the StarForce protection, which was used in the previous TrackMania games, such as Sunrise and Original. The format evolved in many ways over the years, reaching up to version 18 that is currently used both for the Maniaplanet platform and in Trackmania 2020.

Structure

The structure of the Pak file is slightly different between TrackMania United Forever (up to 2008) and Maniaplanet (from 2010).

Up to 2008 (version 3)

Pak files until the release of Forever games use version 3. This version always encrypts everything in the file, including the header. The only unencrypted information is the version itself and the Blowfish initialization vector. The key used to decrypt each of these Pak files is stored in the paklist.dat file located in the Packs directory of the installation, next to the other Pak files.

Individual files are compressed using zlib.

From 2010 (version 6 to 18)

Newer Pak files have an unencrypted header with various descriptive metadata about their contents. That includes:

  • SHA256 checksum of the header contents, used for comparison regarding validity and updates
  • Author of the package, their login, nickname, and zone
  • Description (comments)
  • Build information
  • Creation date
  • Metadata about other included Pak content
  • Custom download URL (version 13+)

There are 2 types of keys used for actual decryption:

  • Header key - decrypts the list of files and directories
  • File key - decrypts the file contents

These 2 keys are formed from the base key that is either hardcoded in the game executable or resolved from an encrypted key given from the master server. The base key is then used to create the file key like this:

 fileKey = md5(baseKey + "NadeoPak")

The header key is then created like this:

 headerKey = fileKey ^ 0xCE591D76EBFC7DA1N90BCB6DEBBCBEE56N

Individual files are compressed using zlib up to version 17. From version 18, LZ4 is used.