SecreatAI is a game prototype built around AI-encoded file transfer. The goal is to train an autoencoder, use that model to transform a file into a .aiz file protected by a mask password, then challenge another player to reconstruct the file with their own model or their own analysis methods.
Important: this project is a playful and educational experiment about autoencoders, binary representations, and pattern analysis. It is not a reliable encryption tool for protecting sensitive data.
Each player has an autoencoder model trained separately. One player encodes a file with their model, shares only the .aiz file, and the opponent tries to decode it.
The encoding player scores points if the opponent cannot reconstruct the file. The opponent scores points if they manage to produce a correct reconstruction.
- Tkinter GUI for training, encoding, and decoding.
- Train or resume training of a
.pklmodel. - Encode files into
.aizwith a random salt and mask password. - Decode files into the
decoded/folder. - Training loss curve in the interface.
- Pattern analysis tool for comparing two
.aizfiles. - Separate scripts for training, encoding, and decoding.
- Python 3.10, configured by
.python-version. pip.tkinterfor the graphical interface.
On some Linux distributions, tkinter must be installed through the system package manager, for example:
sudo apt install python3-tkFrom the project folder:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
export MPLCONFIGDIR=.matplotlib-cacheThe current Python dependencies are intentionally lightweight:
numpymatplotlib
The project also uses modules from the Python standard library, including pickle, lzma, hashlib, tarfile, threading, and tkinter.
The graphical interface is the easiest way to use the project:
python SecreatAI_GUI.pyIn the interface:
- Choose an existing model or click
New Model. - Click
Train / Resumeto create or continue training the model. - Choose a file with
Browse. - Click
Encode, enter a password, then produce a.aizfile. - Click
Decode, enter the same password, then reconstruct a file from a.aiz.
Decoded files are written to decoded/. In the interface, files chosen outside the project folder are first copied into the application folder before encoding or decoding.
The main scripts can also be called from Python.
python Training_only.pyBy default, this script creates or resumes model.pkl.
To use another model name:
python -c "import Training_only; Training_only.model_name='alice.pkl'; Training_only.main()"python -c "import Encode_only; Encode_only.main('model.pkl', 'mon_fichier.pdf', mask_password='secret')"If the internal reconstruction reaches 100%, a mon_fichier.pdf.aiz file is created in the same folder as the source file, unless an output folder is provided.
Example with an output folder:
python -c "import Encode_only; Encode_only.main('model.pkl', 'mon_fichier.pdf', output_dir='encoded', mask_password='secret')"If mask_password is not provided, the script asks for the password in the terminal.
python -c "import Decode_only; Decode_only.main('model.pkl', 'mon_fichier.pdf.aiz', mask_password='secret')"By default, the result is written to decoded/ with the .aiz suffix removed. For .aiz files produced with a password, the same password is required for decoding.
python pattern_aiz_compare.py fichier1.aiz fichier2.aizThis script displays statistics about 64-bit blocks, repetitions, entropy, and Hamming distance. It helps identify whether visible patterns remain in encoded files.
- Each player trains their own
.pklmodel. - The active player chooses a source file.
- They encode the file into
.aizand verify that their own model can reconstruct the file. - They keep their password secret or define a sharing rule before the round.
- They send only the
.aizfile to the opponent. - The opponent tries to decode the file with their model or with any other analysis strategy.
- The original file is revealed.
- Points are awarded:
- opponent wins if the file is correctly reconstructed;
- encoder wins if the file remains undecipherable.
- Roles rotate in the next round.
.
|-- SecreatAI_GUI.py # Graphical interface
|-- Training_only.py # Train/resume a model
|-- Encode_only.py # Encode a file to .aiz
|-- Decode_only.py # Decode a .aiz
|-- Autoencoder_Encoder_Decoder.py # Historical combined version
|-- Autoencoder_Encoder_Decoder_timed.py
|-- pattern_aiz_compare.py # Pattern analysis between .aiz files
|-- Compare_files.py # Simple binary file comparison
|-- requirements.txt
|-- model.pkl # Default model, if present
`-- decoded/ # Decoded outputs
*.pkl: trained models. The providedmodel.pklfile is used as the default model.*.aiz: encoded files. These outputs are generated locally and ignored by Git.decoded/: reconstructed files..matplotlib-cache/: local Matplotlib cache.__pycache__/: Python cache.
These files are ignored by .gitignore when they are temporary or generated.
The model works on 8-bit input blocks and produces 64-bit encoded representations. The original file bytes are first masked with a random salt and optional password, then the masked bytes are encoded by the model and compressed with lzma before the .aiz file is written. If a password is provided, it is combined with the salt using sha256 to produce the mask stream.
Training uses a custom dense neural network implementation and the Adam optimizer with numpy. Training and validation losses are stored in the .pkl file, allowing the interface to display the history.
- The
.aizformat is not cryptographic encryption. - The mask password makes analysis harder, but it does not replace real encryption.
- The same model can reveal exploitable regularities depending on the files and training level.
- The CLI scripts do not have an
argparseinterface yet; advanced calls are therefore made throughpython -cor through the GUI. picklemust not be used with untrusted models: loading a.pklfile from an unknown source can execute arbitrary code.
Define a local cache folder:
export MPLCONFIGDIR=.matplotlib-cacheInstall the Tkinter system package matching your Python. On Debian/Ubuntu:
sudo apt install python3-tkCheck that the .aiz was decoded with the same model and the same password used for encoding. In the game, using another model is part of the challenge, but exact reconstruction is then not guaranteed.
The provided password does not match the .aiz file, or the encoded file is incomplete/corrupted. Try again with the password used during encoding.
This project is distributed under the MIT license. See LICENSE.