===================================================================================================
PAK KEY GENERATOR
AUTHOR: Lord Zapharos (www.lordzapharos.com)
DATE: 19 August 2020
===================================================================================================



DISCLAIMER:
===================================================================================================

I did not write KeyGen.exe myself. This file is compiled from CryEngine and, as such, all rights to
the source code belong to Crytek, its subsidiaries, and/or its affiliates.



USAGE:
===================================================================================================

Everything in this folder is intended for advanced developers only.

IT IS IN EVERYONE'S BEST INTEREST TO USE THE GENERATED KEY.DAT AND KEY.H provided by the Crysis 3
Mod Enabler. I cannot stress this point strongly enough!

When everyone uses the same key to encrypt their .PAK files, they ensure that everyone else can use
that mod. Using the same key also allows future mod developers (or users) to combine different mods
together or use multiple mods side-by-side. This is especially important when a prominent mod
author retires or when the original encryption key is lost -- if a custom key is used in these
scenarios, the mod may be completely irretrievable!

The encryption of assets by EA/Crytek is what necessitated this mod in the first place, and that
same encryption has precluded ALL mod development in Crysis 3 for over seven years. Everyone
benefits when mods are both open and free, so please consider the consequences before generating a
private encryption key for your mod.

However, because I strongly believe in reproducibility, I have chosen to include the application
KeyGen.exe in this folder. To use this application, simply run KeyGen.exe and two files will be
generated in this directory: key.dat and key.h. The first file is a private key used for encrypting
each .PAK file. The second file key.h is a public key for decrypting all of the game's .PAK files.

After generating the key files, place both of them in the folder immediately one level up from this
directory (i.e. in the same folder as PakEncrypt.exe). When users run enableCrysis3ModSupport.py,
these keys will re-encrypt all Crysis 3 assets such that they can use your mod.

Your final step is to move the hexadecimal key from key.h to crysis3ModEnabler.CT. To do this, edit
the CT file with Notepad and change the value in line 45 (beginning with "primaryRecord.Value = ")
to your decryption key from key.h. Cheat Engine uses decimal values, so you will need to convert.
For example, the decryption key "FF 00 0A" would become "255 0 10". YOU MUST ZERO-PAD THE KEY to
ensure that it is 162 bytes long. For example, "FF 00 0A" would become "255 0 10" followed by 159
space-separated zeroes.

After users download your mod and run enableCrysis3ModSupport.py, all they need to do is open
crysis3ModEnabler.CT with Cheat Engine, run the Lua script, and open Crysis 3 (in that order!).

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: with a custom key, your users will be unable to use any other mods alongside your own! It
will also take 30-60 minutes for anyone to use your mod, as they need to re-encrypt their entire
Crysis 3 directory. Due to this inconvenience, it is in everyone's best interest to use the
original keys given by Crysis 3 Mod Enabler. It's easier, faster, and better for everyone!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
